logo

/Code Snippet|v2.3.0

Module

Static Methods

extend(target, objects)extend.jsline 19

Extend the target object from other objects.

PARAMETERS
NameTypeDescription

target

object

Object that will be extended

objects

object

Objects as sources

RETURNS:
{

object

} - Extended object

pick(obj, paths)pick.jsline 35

Retrieve a nested item from the given object/array.

PARAMETERS
NameTypeDescription

obj

objectArray

Object for retrieving

paths

stringnumber

Paths of property

RETURNS:
{

*

} - Value
EXAMPLES
var pick = require('tui-code-snippet/object/pick'); // node, commonjs

var obj = {
    'key1': 1,
    'nested' : {
        'key1': 11,
        'nested': {
            'key1': 21
        }
    }
};
pick(obj, 'nested', 'nested', 'key1'); // 21
pick(obj, 'nested', 'nested', 'key2'); // undefined

var arr = ['a', 'b', 'c'];
pick(arr, 1); // 'b'
Resizable