to-object-path-js

1.0.1 • Public • Published

to-object-path-js NPM version NPM monthly downloads NPM total downloads Linux Build Status

This is a fork of the package created by Jon Schlinkert. The original package has not been updated for several years and has multiple security vulnerabilities. Creating this fork was the only way to address them. Read this issue for more information.

Create an object path from a list or array of strings.

Install

Install with npm

$ npm i to-object-path-js --save

Usage

var toPath = require('to-object-path-js');

toPath('foo', 'bar', 'baz');
toPath('foo', ['bar', 'baz']);
//=> 'foo.bar.baz'

Also supports passing an arguments object (without having to slice args):

function foo() {
  return toPath(arguments);
}

foo('foo', 'bar', 'baz');
foo('foo', ['bar', 'baz']);
//=> 'foo.bar.baz'

Visit the example to see how this could be used in an application.

Related projects

  • get-value: Use property paths ( a.b.c) to get a nested value from an object. | homepage
  • has-value: Returns true if a value exists, false if empty. Works with deeply nested values using… more | homepage
  • omit-value: Omit properties from an object or deeply nested property of an object using object path… more | homepage
  • set-value: Create nested values and any intermediaries using dot notation ('a.b.c') paths. | homepage
  • unset-value: Delete nested properties from an object using dot notation. | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Oron Nadiv

Jon Schlinkert

Package Sidebar

Install

npm i to-object-path-js

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.8 kB

Total Files

4

Last publish

Collaborators

  • oronnadiv