Skip to content

Latest commit

 

History

History
77 lines (60 loc) · 2.8 KB

File metadata and controls

77 lines (60 loc) · 2.8 KB

Module Get object by path

Find an object by giving it a path with or without context.
Returns an object containing information about the object and paths.

Statistics

Github All Releases npm

Social

GitHub forks GitHub stars GitHub watchers Gitter

Project Health

Travis branch Codecov bitHound bitHound Website

Install

$ npm install @brickify/m-gobp

Usage

var getObject = require('@brickify/m-gobp');

var context = {
  foo: {
    bar: {
      baz: function() {
      }
    }
  }
};

// Use defined context
getObject('foo.bar.baz', context);


process.foo = {
    bar: {
      baz: function() {
      }
    }
};

// Use global context
getObject('foo.bar.baz');

Returns

{
  context: object|process|global|window,
  object: {
    decomposed: [...objects],
    first: object|process|global|window,
    last: End object value,
    parent: End parent object
  },
  paths: {
    decomposed: [...paths],
    first: first path,
    last: End parent object path
  }
}