Object

Object

Source:

Methods

ifHasProperty(propertyName, callback)

To do something if the object hasOwnProperty.

Source:

To do something if the object hasOwnProperty.

Example
{name: 'Bendy'}.ifHasProperty('name', function(propertyValue) { console.debug(propertyValue); });
// Bendy
Parameters:
Name Type Description
propertyName string

The property name.

callback function

The callback function.

prop(propertyName, propertyValueopt) → {*}

Gets or sets property value.

Source:

Gets or sets property value.

Example
{person: {name: 'Bendy'}}.prop('person.name');
// => Bendy

{name: 'Bendy'}.prop('age', 100);
// => {name: 'Bendy', age: 100}
Parameters:
Name Type Attributes Description
propertyName string

The property name.

propertyValue * <optional>

The property value.

Requires:
Returns:
  • The property value if propertyValue not set, otherwise nothing.
Type
*

toJson() → {string}

Converts an object to json string.

Source:

Converts an object to json string.

Example
{name:'zhang'}.toJsonString();
// => "{"name":"zhang"}"
Returns:

A json string.

Type
string

Object

Methods

ifHasProperty(propertyName, callback)

To do something if the object hasOwnProperty.

Source:

To do something if the object hasOwnProperty.

Example
{name: 'Bendy'}.ifHasProperty('name', function(propertyValue) { console.debug(propertyValue); });
// Bendy
Parameters:
Name Type Description
propertyName string

The property name.

callback function

The callback function.

prop(propertyName, propertyValueopt) → {*}

Gets or sets property value.

Source:

Gets or sets property value.

Example
{person: {name: 'Bendy'}}.prop('person.name');
// => Bendy

{name: 'Bendy'}.prop('age', 100);
// => {name: 'Bendy', age: 100}
Parameters:
Name Type Attributes Description
propertyName string

The property name.

propertyValue * <optional>

The property value.

Requires:
Returns:
  • The property value if propertyValue not set, otherwise nothing.
Type
*

toJson() → {string}

Converts an object to json string.

Source:

Converts an object to json string.

Example
{name:'zhang'}.toJsonString();
// => "{"name":"zhang"}"
Returns:

A json string.

Type
string