Charter · API

normalizeRole

Returns one role definition as its allow, deny, extends and without lists for one section, with shorthand forms expanded. It is intended for tools that inspect a charter, and verifyCharter uses it. In the example the top-level allow and deny expand into actions, and the data array expands into an allow list.

Role
{
  extends: ['usher'],
  allow: ['*'],
  deny: ['me.*'],
  data: ['*.read'],
}
Normalized role by section
{
  actions: {
    allow: ['*'],
    deny: ['me.*'],
    extends: ['usher'],
    without: [],
  },
  data: {
    allow: ['*.read'],
    deny: [],
    extends: ['usher'],
    without: [],
  },
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.