crocks
crocks copied to clipboard
Adding support for Symbol properties
Describe the bug Symbols are valid keys for 'names' of properties on JavaScript objects. We should support it
To Reproduce Steps to reproduce the behavior:
- Use
hasPropwith a Symbol property - Pass in an object with a Symbol property on it
- Wait....
- See error
Expected behavior Should allow property accessors to be symbols
I have made a start at implementing this.
There are many files to update.
So far:
Maybe/getPath.js Maybe/getPath.spec.js Maybe/getProp.js Maybe/getProp.spec.js Maybe/prop.spec.js Maybe/propPath.spec.js helpers/assoc.spec.js helpers/dissoc.spec.js helpers/getPathOr.js helpers/getPathOr.spec.js helpers/getPropOr.js helpers/getPropOr.spec.js helpers/propOr.spec.js helpers/propPathOr.spec.js helpers/setPath.js helpers/setPath.spec.js helpers/setProp.js helpers/setProp.spec.js helpers/unsetPath.js helpers/unsetPath.spec.js helpers/unsetProp.js helpers/unsetProp.spec.js predicates/hasProp.js predicates/hasProp.spec.js predicates/hasPropPath.js predicates/hasPropPath.spec.js predicates/hasProps.js predicates/hasProps.spec.js predicates/pathEq.js predicates/pathEq.spec.js predicates/pathSatisfies.js predicates/pathSatisfies.spec.js predicates/propEq.js predicates/propEq.spec.js predicates/propPathEq.spec.js predicates/propPathSatisfies.spec.js predicates/propSatisfies.js predicates/propSatisfies.spec.js
For paths I have put this wording (affects related test):
Non-empty Array of Non-empty Strings, Positive Integers and/or Symbols required ...
@evilsoft Is this fine, also is it worth making an isValidKey helper?
There is also objOf, fromPairs, defineUnion & pick. Should omit vaildate keys?
Anything I missed?