a zip code crypto-currency system good for red ONLY

index.js 958B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*!
  2. * arr-diff <https://github.com/jonschlinkert/arr-diff>
  3. *
  4. * Copyright (c) 2014 Jon Schlinkert, contributors.
  5. * Licensed under the MIT License
  6. */
  7. 'use strict';
  8. var flatten = require('arr-flatten');
  9. var slice = [].slice;
  10. /**
  11. * Return the difference between the first array and
  12. * additional arrays.
  13. *
  14. * ```js
  15. * var diff = require('{%= name %}');
  16. *
  17. * var a = ['a', 'b', 'c', 'd'];
  18. * var b = ['b', 'c'];
  19. *
  20. * console.log(diff(a, b))
  21. * //=> ['a', 'd']
  22. * ```
  23. *
  24. * @param {Array} `a`
  25. * @param {Array} `b`
  26. * @return {Array}
  27. * @api public
  28. */
  29. function diff(arr, arrays) {
  30. var argsLen = arguments.length;
  31. var len = arr.length, i = -1;
  32. var res = [], arrays;
  33. if (argsLen === 1) {
  34. return arr;
  35. }
  36. if (argsLen > 2) {
  37. arrays = flatten(slice.call(arguments, 1));
  38. }
  39. while (++i < len) {
  40. if (!~arrays.indexOf(arr[i])) {
  41. res.push(arr[i]);
  42. }
  43. }
  44. return res;
  45. }
  46. /**
  47. * Expose `diff`
  48. */
  49. module.exports = diff;