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.

24 lines
598 B

4 years ago
  1. # `diffAssoc()`
  2. The diffAssoc method compares the collection against another collection or a plain object based on its keys and values.
  3. This method will return the key / value pairs in the original collection that are not present in the given collection:
  4. ```js
  5. const collection = collect({
  6. color: 'orange',
  7. type: 'fruit',
  8. remain: 6,
  9. });
  10. const diff = collection.diffAssoc({
  11. color: 'yellow',
  12. type: 'fruit',
  13. remain: 3,
  14. used: 6,
  15. });
  16. diff.all();
  17. // { color: 'orange', remain: 6 };
  18. ```
  19. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/diffAssoc.js)