Closed jabjab closed 9 years ago
Agreed. This should be fixed. key path conversion should match exactly how Immutable Cursors does it: https://github.com/facebook/immutable-js/blob/3799d5f223315a41ceb524b627e558c548f3b7c5/contrib/cursor/index.js#L305-L309
This can be patched at the following lines:
Very true. Good catch. Fixed in cab0d24.
Immutable's cursors, including
Cursor.from
, usevalToKeyPath
under the hood to convert''
to['']
, but structures and references handle.cursor('')
, as well as.cursor(0)
and other falsey keys, as though they are all.cursor()
(andstructure.reference('')
is handled asstructure.reference()
). Because of this, the following happens:While an edge case, this means users who can't enforce a policy restricting keys to values that do not evaluate to false have to use the same sort of checks
valToKeyPath
does already to ensure any supplied values are properly converted to key paths.