pacc
v6.6.2
Published
property path utils
Readme
pacc
propetty path utils
import { getAttribute } from "pacc";
const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
// result === 4API
Table of Contents
- prepareAttributesDefinitions
- mergeAttributeDefinitions
- attributeIterator
- parseBytes
- AttributeDefinition
- default_attribute
- default_attribute
- default_attribute
- default_attribute_writable
- default_attribute_writable
- default_attribute_writable
- default_attribute_writable
- string_collection_attribute_writable
- name_attribute
- name_attribute_writable
- email_attribute
- version_attribute
- version_attribute_writable
- description_attribute
- boolean_attribute
- boolean_attribute_writable
- boolean_attribute_writable_true
- boolean_attribute_writable_true
- boolean_attribute_writable_false
- boolean_attribute_false
- empty_attribute
- uuid_attribute
- secret_attribute
- secret_attribute
- secret_attribute
- secret_attribute
- secret_attribute
- private_key_attribute
- public_key_attribute
- number_attribute
- number_attribute_writable
- integer_attribute
- integer_attribute
- integer_attribute
- integer_attribute_writable
- integer_attribute_writable
- object_attribute
- url_attribute
- url_attribute_writable
- hostname_attribute
- port_attribute
- id_attribute
- title_attribute_writable
- priority_attribute
- duration_attribute
- duration_ms_attribute
- timeout_attribute
- language_attribute
- environmentValues
- expand
- filter
- setAttributes
- getAttributes
- getAttributesJSON
- tokens
- tokens
- setAttribute
- getAttribute
- getAttributeAndOperator
- parseDuration
- formatDuration
- formatDurationISO
- lookup
- Token
- createToken
- PLUS
- MINUS
- STAR
- DIVIDE
- NOT
- NOT_EQUAL
- EQUAL
- GREATER
- GREATER_EQUAL
- LESS
- LESS_EQUAL
- OPEN_ROUND
- CLOSE_ROUND
- OPEN_BRACKET
- CLOSE_BRACKET
- OPEN_CURLY
- CLOSE_CURLY
- QUESTION
- COLON
- SEMICOLON
- COMMA
- DOT
- AMPERSAND
- DOUBLE_AMPERSAND
- BAR
- DOUBLE_BAR
- IDENTIFIER
- EOF
- Type
prepareAttributesDefinitions
Create attributes from its definition.
Parameters
Returns Object attributes
mergeAttributeDefinitions
Merge attribute definitions.
Parameters
destObject attribute definitions to be used also the merge targetattsObject? attribute definitions to be used
Returns Object merged definitions (dest)
attributeIterator
Iterate over all attributes.
Parameters
Returns Iterable<[Array<string>, object]>
parseBytes
Convert byte size formatted string into number of bytes.
Parameters
Returns number number of total bytes
AttributeDefinition
Type: Object
Properties
typeobjectisKeybooleanwritablebooleanmandatorybooleancollectionbooleanprivateboolean? should the value be showncredentialboolean? any type of credentialpersistentboolean? should we be storeddependsstring? name of an attribute we depend ondescriptionstring? human readabledefaultany? the default valuesetFunction? set the valuegetFunction? get the value can be used to calculate default valuesprepareValueFunction?valuesSet<any>? allowed valuesexternalNamestring? attrubute name used by external systemenv(Array<string> | string)? environment variable(s) used to provide the valueadditionalValuesobject? other values to be set in case our attribute is set
default_attribute
Common attribute properties.
Type: AttributeDefinition
default_attribute
Type: AttributeDefinition
default_attribute
Type: AttributeDefinition
default_attribute_writable
Type: AttributeDefinition
default_attribute_writable
Type: AttributeDefinition
default_attribute_writable
Type: AttributeDefinition
default_attribute_writable
The body text.
Type: AttributeDefinition
string_collection_attribute_writable
Type: AttributeDefinition
name_attribute
Type: AttributeDefinition
name_attribute_writable
Type: AttributeDefinition
email_attribute
Type: AttributeDefinition
version_attribute
Type: AttributeDefinition
version_attribute_writable
Type: AttributeDefinition
description_attribute
The description of the object content.
Type: AttributeDefinition
boolean_attribute
Type: AttributeDefinition
boolean_attribute_writable
Type: AttributeDefinition
boolean_attribute_writable_true
Type: AttributeDefinition
boolean_attribute_writable_true
Type: AttributeDefinition
boolean_attribute_writable_false
Type: AttributeDefinition
boolean_attribute_false
Type: AttributeDefinition
empty_attribute
Type: AttributeDefinition
uuid_attribute
Type: AttributeDefinition
secret_attribute
Type: AttributeDefinition
secret_attribute
Type: AttributeDefinition
secret_attribute
Type: AttributeDefinition
secret_attribute
Type: AttributeDefinition
secret_attribute
Type: AttributeDefinition
private_key_attribute
Type: AttributeDefinition
public_key_attribute
Type: AttributeDefinition
number_attribute
Type: AttributeDefinition
number_attribute_writable
Type: AttributeDefinition
integer_attribute
Type: AttributeDefinition
integer_attribute
Type: AttributeDefinition
integer_attribute
Type: AttributeDefinition
integer_attribute_writable
Type: AttributeDefinition
integer_attribute_writable
Type: AttributeDefinition
object_attribute
Type: AttributeDefinition
url_attribute
Type: AttributeDefinition
url_attribute_writable
Type: AttributeDefinition
hostname_attribute
Type: AttributeDefinition
port_attribute
Type: AttributeDefinition
id_attribute
Unique id within.
Type: AttributeDefinition
title_attribute_writable
The one line description.
Type: AttributeDefinition
priority_attribute
In case there are several providers able to support a given source which one sould be used ? this defines the order.
Type: AttributeDefinition
duration_attribute
Type: AttributeDefinition
duration_ms_attribute
Type: AttributeDefinition
timeout_attribute
Type: AttributeDefinition
language_attribute
Type: AttributeDefinition
environmentValues
Extract values from environment.
Parameters
envObject as from process.envattributesObject as from process.envinstanceIdentifierstring part of variable name.
Returns (Object | undefined) undefined if no suitable environment variables have been found
expand
Expand expressions inside of object graphs.
Parameters
objectanycontextObject (optional, default{})
Returns any
filter
Generate filter function.
Parameters
filterByObject?
Returns Function
setAttributes
Copies attribute values from a source object into a destination object.
Parameters
objectObject target object to be modifiedsourceObject origin of the data to be copieddefinitionsObject attribute definitions to be usedcbfunction? callback to be executed for each copied value
getAttributes
Retrive attribute values from an object.
Parameters
Returns Object values
getAttributesJSON
Retrive attribute values from an object.
Parameters
Returns Object values
tokens
tokens
Split property path into tokens
Parameters
stringstring
setAttribute
Set object attribute. The name may be a property path like 'a.b.c'.
Parameters
getAttribute
Deliver attribute value. The name may be a property path like 'a.b.c' or a[2]
Parameters
Returns any value associated with the given property name
getAttributeAndOperator
Deliver attribute value and operator. The name may be a property path like 'a.b.c <='.
Parameters
Returns [any, Token] value associated with the given property name
parseDuration
Convert duration formatted string into number of seconds.
Parameters
Returns number seconds
formatDuration
Parameters
secondsnumber
Returns string formatted duration
formatDurationISO
Parameters
secondsnumber
Returns string formatted duration
lookup
Token lookup
Token
Type: Object
Properties
strstring
createToken
Parameters
strstringprecedence(optional, default0)type
Returns Token
PLUS
Type: Token
MINUS
Type: Token
STAR
Type: Token
DIVIDE
Type: Token
NOT
Type: Token
NOT_EQUAL
Type: Token
EQUAL
Type: Token
GREATER
Type: Token
GREATER_EQUAL
Type: Token
LESS
Type: Token
LESS_EQUAL
Type: Token
OPEN_ROUND
Type: Token
CLOSE_ROUND
Type: Token
OPEN_BRACKET
Type: Token
CLOSE_BRACKET
Type: Token
OPEN_CURLY
Type: Token
CLOSE_CURLY
Type: Token
QUESTION
Type: Token
COLON
Type: Token
SEMICOLON
Type: Token
COMMA
Type: Token
DOT
Type: Token
AMPERSAND
Type: Token
DOUBLE_AMPERSAND
Type: Token
BAR
Type: Token
DOUBLE_BAR
Type: Token
IDENTIFIER
Type: Token
EOF
Type: Token
Type
Type: Object
Properties
install
With npm do:
npm install pacclicense
BSD-2-Clause
