Update README.md
This commit is contained in:
parent
5e9e9d8a41
commit
a881915cfe
|
@ -61,7 +61,7 @@ API
|
||||||
|
|
||||||
**NOTE**: You cannot omit optional parameters. Use `null` if you want accepts the defaults for some things and provide a values for others. For example: `JsonStorage.create(null, null, { stringify: false })`
|
**NOTE**: You cannot omit optional parameters. Use `null` if you want accepts the defaults for some things and provide a values for others. For example: `JsonStorage.create(null, null, { stringify: false })`
|
||||||
|
|
||||||
null vs undefined in JSON
|
JSON / DOMStorage Conversion Gotchas
|
||||||
===
|
===
|
||||||
|
|
||||||
These notes do not reflect a bugs or defects in this library,
|
These notes do not reflect a bugs or defects in this library,
|
||||||
|
@ -71,6 +71,8 @@ they're simply to inform you of a few 'gotchas' inherent in JSON / DOMStorage co
|
||||||
If they do, you're probably doing something wrong in the first place.
|
If they do, you're probably doing something wrong in the first place.
|
||||||
|
|
||||||
|
|
||||||
|
### `undefined` vs `null`
|
||||||
|
|
||||||
It is not valid to set `undefined` in JSON. So setting a key to `undefined` will remove it from the store.
|
It is not valid to set `undefined` in JSON. So setting a key to `undefined` will remove it from the store.
|
||||||
|
|
||||||
This means that `store.set('x')` is the same as `store.remove('x')`.
|
This means that `store.set('x')` is the same as `store.remove('x')`.
|
||||||
|
@ -85,6 +87,8 @@ Note that both values that exist as `null` and values that don't exist at all wi
|
||||||
null === store.get('non-existant-key');
|
null === store.get('non-existant-key');
|
||||||
|
|
||||||
|
|
||||||
|
### `null` vs `"null"`
|
||||||
|
|
||||||
The special case of `null` as `"null"`, aka `"\"null\""`:
|
The special case of `null` as `"null"`, aka `"\"null\""`:
|
||||||
|
|
||||||
`null`, and `"null"` both parse as `null` the "object", instead of one being the string (which would be `"\"null\""`).
|
`null`, and `"null"` both parse as `null` the "object", instead of one being the string (which would be `"\"null\""`).
|
||||||
|
|
Loading…
Reference in New Issue