You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # union-value [![NPM version](https://img.shields.io/npm/v/union-value.svg?style=flat)](https://www.npmjs.com/package/union-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/union-value.svg?style=flat)](https://npmjs.org/package/union-value) [![NPM total downloads](https://img.shields.io/npm/dt/union-value.svg?style=flat)](https://npmjs.org/package/union-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/union-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/union-value)
  2. > Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save union-value
  7. ```
  8. ## Usage
  9. ```js
  10. var union = require('union-value');
  11. var obj = {};
  12. union(obj, 'a.b.c', ['one', 'two']);
  13. union(obj, 'a.b.c', ['three']);
  14. console.log(obj);
  15. //=> {a: {b: {c: [ 'one', 'two', 'three' ] }}}
  16. ```
  17. ## About
  18. ### Related projects
  19. * [assign-value](https://www.npmjs.com/package/assign-value): Assign a value or extend a deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/assign-value) | [homepage](https://github.com/jonschlinkert/assign-value "Assign a value or extend a deeply nested property of an object using object path notation.")
  20. * [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 "Use property paths (`a.b.c`) to get a nested value from an object.")
  21. * [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://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.")
  22. * [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 "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.")
  23. * [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 "Delete nested properties from an object using dot notation.")
  24. ### Contributing
  25. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  26. ### Building docs
  27. _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
  28. To generate the readme, run the following command:
  29. ```sh
  30. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  31. ```
  32. ### Running tests
  33. Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
  34. ```sh
  35. $ npm install && npm test
  36. ```
  37. ### Author
  38. **Jon Schlinkert**
  39. * [github/jonschlinkert](https://github.com/jonschlinkert)
  40. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  41. ### License
  42. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  43. Released under the [MIT License](LICENSE).
  44. ***
  45. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 25, 2017._