diff --git a/pointer.ts b/pointer.ts index d5c5d57..e1a5f7a 100644 --- a/pointer.ts +++ b/pointer.ts @@ -69,8 +69,10 @@ export class Pointer { for (let i = 1, l = this.tokens.length; i < l; i++) { parent = value key = this.tokens[i] + if (['__proto__', 'constructor', 'prototype'].includes(key)) + continue; // not sure if this the best way to handle non-existant paths... - value = (parent || {})[key] + value = parent?.[key] } return {parent, key, value} }