jquense / expr

tiny util for getting and setting deep object props safely

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getter doesn't work with non alphanumeric keys

csantos1113 opened this issue · comments

You know we can have objects with keys with more than alphanumeric characters, like:

const externalIdentifier: 'FE43-D880-21AE';
const data = {
   [externalIdentifier]: true 
};

When we use the getter to access that id, it throws an error exception:

const getFn = getter(externalIdentifier);
console.log(getFn(data);

Error:

Uncaught ReferenceError: D880 is not defined
at eval (eval at getter (:26:43), :3:16)
at :1:1

care to send a PR?

@jquense Will you be able to create a new release of property-expr and yup that includes the changes in PR #4? I believe that should resolve this issue.