ryardley/pdsl

Dot syntax for accessing deeply nested properties.

ryardley opened this issue · 1 comments

It could be useful to have a dot syntax for deeply nested objects:

const isAdmin = p`{ user.roles: [? "admin" ] }`

isAdmin({
  user: {
    roles: [ "editor", "admin" ]
  }
}); // true

With optional properties no need for optional coalescing as the property is explorative.

const isAdmin = p`{ user.roles?: [? "admin" ] }`