@muze-nl/od-jsontag 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/jsontag.mjs.bak +65 -0
- package/src/jsontag.mjs~ +65 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muze-nl/od-jsontag",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "On Demand JSONTag: parse/serialize large datastructures on demand, useful for sharing data between threads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Auke van Slooten <auke@muze.nl>",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"LICENSE"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@muze-nl/jsontag": "^0.9.
|
|
37
|
+
"@muze-nl/jsontag": "^0.9.6"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import JSONTag from '@muze-nl/jsontag'
|
|
2
|
+
import {source} from './symbols.mjs'
|
|
3
|
+
|
|
4
|
+
function getSource(obj) {
|
|
5
|
+
if (obj && Object.hasOwn(obj, source)) {
|
|
6
|
+
obj = obj[source]
|
|
7
|
+
}
|
|
8
|
+
return obj
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getType(obj) {
|
|
12
|
+
obj = getSource(obj)
|
|
13
|
+
return JSONTag.getType(obj)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getAttribute(obj, attr) {
|
|
17
|
+
obj = getSource(obj)
|
|
18
|
+
return JSONTag.getAttribute(obj, attr)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getAttributes(obj) {
|
|
22
|
+
obj = getSource(obj)
|
|
23
|
+
return JSONTag.getAttributes(obj)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getAttributeString(obj) {
|
|
27
|
+
obj = getSource(obj)
|
|
28
|
+
return JSONTag.getAttributesString(obj)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getTypeString(obj) {
|
|
32
|
+
obj = getSource(obj)
|
|
33
|
+
return JSONTag.getTypeString(obj)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function isNull(obj) {
|
|
37
|
+
obj = getSource(obj)
|
|
38
|
+
return JSONTag.isNull(obj)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function setAttribute(obj, attr, value) {
|
|
42
|
+
obj = getSource(obj)
|
|
43
|
+
return JSONTag.setAttribute(obj, attr, value)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function setAttributes(obj, attr) {
|
|
47
|
+
obj = getSource(obj)
|
|
48
|
+
return JSONTag.setAttribute(obj, attr)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function setType(obj, type) {
|
|
52
|
+
obj = getSource(obj)
|
|
53
|
+
return JSONTag.setType(obj, type)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function addAttribute(obj, attr, value) {
|
|
57
|
+
obj = getSource(obj)
|
|
58
|
+
return JSONTag.addAttribute(obj, attr, value)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function removeAttribute(obj, attr) {
|
|
62
|
+
obj = getSource(obj)
|
|
63
|
+
return JSONTag.removeAttribute(obj, attr)
|
|
64
|
+
}
|
|
65
|
+
|
package/src/jsontag.mjs~
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import JSONTag from '@muze-nl/jsontag'
|
|
2
|
+
import {source} from './symbols.mjs'
|
|
3
|
+
|
|
4
|
+
function getSource(obj) {
|
|
5
|
+
if (obj.hasOwnProperty(source)) {
|
|
6
|
+
obj = obj[source]
|
|
7
|
+
}
|
|
8
|
+
return obj
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getType(obj) {
|
|
12
|
+
obj = getSource(obj)
|
|
13
|
+
return JSONTag.getType(obj)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getAttribute(obj, attr) {
|
|
17
|
+
obj = getSource(obj)
|
|
18
|
+
return JSONTag.getAttribute(obj, attr)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getAttributes(obj) {
|
|
22
|
+
obj = getSource(obj)
|
|
23
|
+
return JSONTag.getAttributes(obj)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getAttributeString(obj) {
|
|
27
|
+
obj = getSource(obj)
|
|
28
|
+
return JSONTag.getAttributesString(obj)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getTypeString(obj) {
|
|
32
|
+
obj = getSource(obj)
|
|
33
|
+
return JSONTag.getTypeString(obj)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function isNull(obj) {
|
|
37
|
+
obj = getSource(obj)
|
|
38
|
+
return JSONTag.isNull(obj)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function setAttribute(obj, attr, value) {
|
|
42
|
+
obj = getSource(obj)
|
|
43
|
+
return JSONTag.setAttribute(obj, attr, value)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function setAttributes(obj, attr) {
|
|
47
|
+
obj = getSource(obj)
|
|
48
|
+
return JSONTag.setAttribute(obj, attr)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function setType(obj, type) {
|
|
52
|
+
obj = getSource(obj)
|
|
53
|
+
return JSONTag.setType(obj, type)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function addAttribute(obj, attr, value) {
|
|
57
|
+
obj = getSource(obj)
|
|
58
|
+
return JSONTag.addAttribute(obj, attr, value)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function removeAttribute(obj, attr) {
|
|
62
|
+
obj = getSource(obj)
|
|
63
|
+
return JSONTag.removeAttribute(obj, attr)
|
|
64
|
+
}
|
|
65
|
+
|