@brickify/m-gobp

2.0.0 • Public • Published

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

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @brickify/m-gobp

    Weekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • nraibaud