2.0.0 • Published 7 years ago

@brickify/m-gobp v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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
  }
}