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 2.8 KiB

3 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # mixin-object [![NPM version](https://badge.fury.io/js/mixin-object.svg)](http://badge.fury.io/js/mixin-object)
  2. > Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone.
  3. If you only want to combine own-properties, use [extend-shallow](https://github.com/jonschlinkert/extend-shallow).
  4. ## Install
  5. Install with [npm](https://www.npmjs.com/)
  6. ```sh
  7. $ npm i mixin-object --save
  8. ```
  9. Install with [bower](http://bower.io/)
  10. ```sh
  11. $ bower install mixin-object --save
  12. ```
  13. ## Usage
  14. ```js
  15. var mixin = require('mixin-object');
  16. var obj = {c: 'c'};
  17. var foo = mixin({a: 'a'}, {b: 'b'});
  18. console.log(foo);
  19. //=> {c: 'c', a: 'a', b: 'b'}
  20. console.log(obj);
  21. //=> {c: 'c'}
  22. mixin({}, {a: 'a'}, {b: 'b'});
  23. //=> {a: 'a', b: 'b'}
  24. ```
  25. ## Related
  26. * [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object.
  27. * [defaults-deep](https://github.com/jonschlinkert/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object.
  28. * [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util.
  29. * [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own)
  30. * [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in)
  31. * [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null.
  32. * [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor.
  33. * [mixin-deep](https://github.com/jonschlinkert/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
  34. * [merge-deep](https://github.com/jonschlinkert/merge-deep): Recursively merge values in a javascript object.
  35. ## Running tests
  36. Install dev dependencies:
  37. ```sh
  38. $ npm i -d && npm test
  39. ```
  40. ## Contributing
  41. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/mixin-object/issues/new)
  42. ## Author
  43. **Jon Schlinkert**
  44. + [github/jonschlinkert](https://github.com/jonschlinkert)
  45. + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  46. ## License
  47. Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
  48. Released under the MIT license.
  49. ***
  50. _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 05, 2015._