corelink
v0.0.2
Published
Utility library for parsing CoRE Link Format
Downloads
2
Readme
Utility for parsing an string in application/link-format into a JS Object.
Examples:
let links = "</1/101>,</1/102>,</2/0>,</2/1>,</2/2>,</3/0>,</5>"
let objects = parse(links);
let str = JSON.stringify(objects, null, '\t');
console.log(str);
//{
// "1": [
// "101",
// "102"
// ],
// "2": [
// "0",
// "1",
// "2"
// ],
// "3": [
// "0"
// ],
// "5": null
//}
links = "</3303/0/5700>,</3303/0/5701>,</3303/1/5603>"
objects = parse(links);
str = JSON.stringify(objects, null, '\t');
console.log(str);
//{
// "3303": {
// "0": [
// "5700",
// "5701"
// ],
// "1": [
// "5603"
// ]
// }
//}