No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 3 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # shallowequal [![Build Status](https://travis-ci.org/dashed/shallowequal.svg)](https://travis-ci.org/dashed/shallowequal) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)
  2. [![Greenkeeper badge](https://badges.greenkeeper.io/dashed/shallowequal.svg)](https://greenkeeper.io/)
  3. > `shallowequal` is like lodash's [`isEqualWith`](https://lodash.com/docs/4.17.4#isEqualWith) but for shallow (strict) equal.
  4. `shallowequal(value, other, [customizer], [thisArg])`
  5. Performs a ***shallow equality*** comparison between two values (i.e. `value` and `other`) to determine if they are equivalent.
  6. The equality is performed by iterating through keys on the given `value`, and returning `false` whenever any key has values which are not **strictly equal** between `value` and `other`. Otherwise, return `true` whenever the values of all keys are strictly equal.
  7. If `customizer` (expected to be a function) is provided it is invoked to compare values. If `customizer` returns `undefined` (i.e. `void 0`), then comparisons are handled by the `shallowequal` function instead.
  8. The `customizer` is bound to `thisArg` and invoked with three arguments: `(value, other, key)`.
  9. **NOTE:** Docs are (shamelessly) adapted from [lodash's v3.x docs](https://lodash.com/docs/3.10.1#isEqualWith)
  10. ## Install
  11. ```sh
  12. $ yarn add shallowequal
  13. # npm v5+
  14. $ npm install shallowequal
  15. # before npm v5
  16. $ npm install --save shallowequal
  17. ```
  18. ## Usage
  19. ```js
  20. const shallowequal = require('shallowequal');
  21. const object = { 'user': 'fred' };
  22. const other = { 'user': 'fred' };
  23. object == other;
  24. // → false
  25. shallowequal(object, other);
  26. // → true
  27. ```
  28. ## Credit
  29. Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`).
  30. ## Development
  31. - `node.js` and `npm`. See: https://github.com/creationix/nvm#installation
  32. - `yarn`. See: https://yarnpkg.com/en/docs/install
  33. - `npm` dependencies. Run: `yarn install`
  34. ### Chores
  35. - Lint: `yarn lint`
  36. - Test: `yarn test`
  37. - Pretty: `yarn pretty`
  38. - Pre-publish: `yarn prepublish`
  39. ## License
  40. MIT.