Projekt

Obecné

Profil

Stáhnout (2.32 KB) Statistiky
| Větev: | Revize:
1
# to-object-path [![NPM version](https://badge.fury.io/js/to-object-path.svg)](http://badge.fury.io/js/to-object-path)
2

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

    
5
## Install
6

    
7
Install with [npm](https://www.npmjs.com/)
8

    
9
```sh
10
$ npm i to-object-path --save
11
```
12

    
13
## Usage
14

    
15
```js
16
var toPath = require('to-object-path');
17

    
18
toPath('foo', 'bar', 'baz');
19
toPath('foo', ['bar', 'baz']);
20
//=> 'foo.bar.baz'
21
```
22

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

    
25
```js
26
function foo()
27
  return toPath(arguments);
28
}
29

    
30
foo('foo', 'bar', 'baz');
31
foo('foo', ['bar', 'baz']);
32
//=> 'foo.bar.baz'
33
```
34

    
35
Visit the [example](./example.js) to see how this could be used in an application.
36

    
37
## Related projects
38

    
39
* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`  a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value)
40
* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://www.npmjs.com/package/has-value) | [homepage](https://github.com/jonschlinkert/has-value)
41
* [omit-value](https://www.npmjs.com/package/omit-value): Omit properties from an object or deeply nested property of an object using object path… [more](https://www.npmjs.com/package/omit-value) | [homepage](https://github.com/jonschlinkert/omit-value)
42
* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value)
43
* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value)
44

    
45
## Running tests
46

    
47
Install dev dependencies:
48

    
49
```sh
50
$ npm i -d && npm test
51
```
52

    
53
## Contributing
54

    
55
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/to-object-path/issues/new).
56

    
57
## Author
58

    
59
**Jon Schlinkert**
60

    
61
+ [github/jonschlinkert](https://github.com/jonschlinkert)
62
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
63

    
64
## License
65

    
66
Copyright © 2015 Jon Schlinkert
67
Released under the MIT license.
68

    
69
***
70

    
71
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 28, 2015._
(2-2/4)