logo

/Code Snippet|v2.3.3

Module

Static Methods

extend(target, objects)extend.jsline 18

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 38

Retrieve a nested item from the given object/array.

PARAMETERS
NameTypeDescription

obj

objectArray

Object for retrieving

paths

stringnumber

Paths of property

RETURNS:
{

*

} - Value
EXAMPLES
// ES6
import pick from 'tui-code-snippet/object/pick';

// CommonJS
const pick = require('tui-code-snippet/object/pick');

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

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