propetty path utils
import { getAttribute } from "pacc";
const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
// result === 4
- AttributeDefinition
- tokens
- tokens
- setAttribute
- getAttribute
- getAttributeAndOperator
- Token
- createToken
- PLUS
- MINUS
- STAR
- DIVIDE
- NOT
- NOT_EQUAL
- GREATER
- GREATER_EQUAL
- LESS
- LESS_EQUAL
- EQUAL
- OPEN_ROUND
- CLOSE_ROUND
- OPEN_BRACKET
- CLOSE_BRACKET
- OPEN_CURLY
- CLOSE_CURLY
- QUESTION
- COLON
- SEMICOLON
- COMMA
- DOT
- AMPERSAND
- DOUBLE_AMPERSAND
- BAR
- DOUBLE_BAR
Type: Object
type
stringisKey
booleanwritable
booleanmandatory
booleanprivate
boolean? should the value be showndepends
string? name of an attribute we depend onadditionalAttributes
Array<string> extra attributes that are present in case our attribute is setdescription
string? human readabledefault
any? the default valueset
Function? set the valueget
Function? get the value can be used to calculate default valuesenv
(Array<string> | string)? environment variable(s) used to provide the value
Split property path into tokens
string
string
Set Object attribute. The name may be a property path like 'a.b.c'.
Deliver attribute value. The name may be a property path like 'a.b.c' or a[2]
Returns any value associated with the given property name
Deliver attribute value and operator. The name may be a property path like 'a.b.c <='.
Returns [any, Token] value associated with the given property name
Type: Object
str
string
str
string
Returns Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
Type: Token
With npm do:
npm install pacc
BSD-2-Clause