@@ -32,13 +32,13 @@ There are two ways to use `devalue`:
32
32
This function takes a JavaScript value and returns the JavaScript code to create an equivalent value — sort of like ` eval ` in reverse:
33
33
34
34
``` js
35
- import { uneval } from ' devalue' ;
35
+ import * as devalue from ' devalue' ;
36
36
37
37
let obj = { message: ' hello' };
38
- uneval (obj); // '{message:"hello"}'
38
+ devalue . uneval (obj); // '{message:"hello"}'
39
39
40
40
obj .self = obj;
41
- uneval (obj); // '(function(a){a.message="hello";a.self=a;return a}({}))'
41
+ devalue . uneval (obj); // '(function(a){a.message="hello";a.self=a;return a}({}))'
42
42
```
43
43
44
44
Use ` uneval ` when you want the most compact possible output and don't want to include any code for parsing the serialized value.
@@ -48,17 +48,17 @@ Use `uneval` when you want the most compact possible output and don't want to in
48
48
These two functions are analogous to ` JSON.stringify ` and ` JSON.parse ` :
49
49
50
50
``` js
51
- import { stringify , parse } from ' devalue' ;
51
+ import * as devalue from ' devalue' ;
52
52
53
53
let obj = { message: ' hello' };
54
54
55
- let stringified = stringify (obj); // '[{"message":1},"hello"]'
56
- parse (stringified); // { message: 'hello' }
55
+ let stringified = devalue . stringify (obj); // '[{"message":1},"hello"]'
56
+ devalue . parse (stringified); // { message: 'hello' }
57
57
58
58
obj .self = obj;
59
59
60
- stringified = stringify (obj); // '[{"message":1,"self":0},"hello"]'
61
- parse (stringified); // { message: 'hello', self: [Circular] }
60
+ stringified = devalue . stringify (obj); // '[{"message":1,"self":0},"hello"]'
61
+ devalue . parse (stringified); // { message: 'hello', self: [Circular] }
62
62
```
63
63
64
64
Use ` stringify ` and ` parse ` when evaluating JavaScript isn't an option.
0 commit comments