PropertyList

PropertyList

new PropertyList(type, parent, populate)

Parameters:
Name Type Description
type String
parent Object
populate Array
Source:

Methods

(static) isPropertyList(obj) → {Boolean}

Checks whether an object is a PropertyList

Parameters:
Name Type Description
obj *
Source:
Returns:
Type
Boolean

add(item)

Add an item or item definition to this list.

Parameters:
Name Type Description
item Object | PropertyList.Type
Source:
To Do:
  • - remove item from original parent if already it has a parent - validate that the original parent's constructor matches this parent's constructor

all() → {Object}

Returns a map of all items.

Source:
Returns:
Type
Object

append(item)

Adds or moves an item to the end of this list.

Parameters:
Name Type Description
item PropertyList.Type
Source:

assimilate(source, pruneopt)

Add or update values from a source list.

Parameters:
Name Type Attributes Default Description
source PropertyList | Array
prune Boolean <optional>
false

Setting this to true will cause the extra items from the list to be deleted

Source:

clear()

Removes all items in the list

Source:

count() → {Number}

Returns the length of the PropertyList

Source:
Returns:
Type
Number

each(iterator, context)

Iterate on each item of this list.

Parameters:
Name Type Description
iterator function
context Object
Source:

eachParent(iterator, contextopt)

Iterates over all parents of the property list

Parameters:
Name Type Attributes Description
iterator function
context Object <optional>
Source:

filter(rule, context)

Parameters:
Name Type Description
rule function
context Object
Source:

find(rule, contextopt) → {Item|ItemGroup}

Find an item within the item group

Parameters:
Name Type Attributes Description
rule function
context Object <optional>
Source:
Returns:
Type
Item | ItemGroup

get(key) → {PropertyList.Type|*}

Get the value of an item in this list. This is similar to PropertyList.one barring the fact that it returns the value of the underlying type of the list content instead of the item itself.

Parameters:
Name Type Description
key String | function
Source:
Returns:
Type
PropertyList.Type | *

has(item, valueopt) → {Boolean}

Check whether an item exists in this list

Parameters:
Name Type Attributes Description
item String | PropertyList.Type
value * <optional>
Source:
Returns:
Type
Boolean

idx(index) → {PropertyList.Type}

Get a member of this list by it's index

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
PropertyList.Type

indexOf(item) → {Number}

Find the index of an item in this list

Parameters:
Name Type Description
item String | Object
Source:
Returns:
Type
Number

insert(item, beforeopt)

Insert an element at the end of this list. When a reference member specified via second parameter is found, the member is inserted at an index before the reference member.

Parameters:
Name Type Attributes Description
item PropertyList.Type
before PropertyList.Type | String <optional>
Source:

insertAfter(item, afteropt)

Insert an element at the end of this list. When a reference member specified via second parameter is found, the member is inserted at an index after the reference member.

Parameters:
Name Type Attributes Description
item PropertyList.Type
after PropertyList.Type | String <optional>
Source:

map(iterator, context)

Iterates over the property list.

Parameters:
Name Type Description
iterator function

Function to call on each item.

context Object

Optional context, defaults to the PropertyList itself.

Source:

one(id) → {PropertyList.Type}

Get Item in this list by ID reference. If multiple values are allowed, the last value is returned.

Parameters:
Name Type Description
id String
Source:
Returns:
Type
PropertyList.Type

populate(items)

Load one or more items

Parameters:
Name Type Description
items Object | Array
Source:

prepend(item)

Adds or moves an item to the beginning of this list.

Parameters:
Name Type Description
item PropertyList.Type
Source:

remove(predicate, context)

Removes all elements from the PropertyList for which the predicate returns truthy.

Parameters:
Name Type Description
predicate function | String | Type
context Object

Optional context to bind the predicate to.

Source:

repopulate(items)

Clears the list and adds new items.

Parameters:
Name Type Description
items Object | Array
Source:

toObject(excludeDisabledopt, nullable, caseSensitiveopt, nullable, multiValueopt, nullable, sanitizeKeysopt) → {Object}

Converts a list of Properties into an object where key is _postman_propertyIndexKey and value is determined by the valueOf function

Parameters:
Name Type Attributes Default Description
excludeDisabled Boolean <optional>
<nullable>
false

When set to true, disabled properties are excluded from the resultant object.

caseSensitive Boolean <optional>
<nullable>

When set to true, properties are treated strictly as per their original case. The default value for this property also depends on the case insensitivity definition of the current property.

multiValue Boolean <optional>
<nullable>
false

When set to true, only the first value of a multi valued property is returned.

sanitizeKeys Boolean <optional>
false

When set to true, properties with falsy keys are removed.

Source:
To Do:
  • Change the function signature to an object of options instead of the current structure.
Returns:
Type
Object

toString() → {String}

Adds ability to convert a list to a string provided it's underlying format has unparse function defined.

Source:
Returns:
Type
String

upsert(item) → (nullable) {Boolean}

Add an item or update an existing item

Parameters:
Name Type Description
item PropertyList~Type
Source:
Returns:
Type
Boolean