Skip to content

Commit 5cf1324

Browse files
committed
more idiomatic
1 parent 9f12397 commit 5cf1324

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ There are two ways to use `devalue`:
3232
This function takes a JavaScript value and returns the JavaScript code to create an equivalent value — sort of like `eval` in reverse:
3333

3434
```js
35-
import { uneval } from 'devalue';
35+
import * as devalue from 'devalue';
3636

3737
let obj = { message: 'hello' };
38-
uneval(obj); // '{message:"hello"}'
38+
devalue.uneval(obj); // '{message:"hello"}'
3939

4040
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}({}))'
4242
```
4343

4444
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
4848
These two functions are analogous to `JSON.stringify` and `JSON.parse`:
4949

5050
```js
51-
import { stringify, parse } from 'devalue';
51+
import * as devalue from 'devalue';
5252

5353
let obj = { message: 'hello' };
5454

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' }
5757

5858
obj.self = obj;
5959

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] }
6262
```
6363

6464
Use `stringify` and `parse` when evaluating JavaScript isn't an option.

0 commit comments

Comments
 (0)