BVB Source Codes

reactide Show index.js Source code

Return Download reactide: download index.js Source code - Download reactide Source code - Type:.js
  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.  
  8. 'use strict';
  9.  
  10. var flatten = require('arr-flatten');
  11. var slice = [].slice;
  12.  
  13. /**
  14.  * Return the difference between the first array and
  15.  * additional arrays.
  16.  *
  17.  * ```js
  18.  * var diff = require('{%= name %}');
  19.  *
  20.  * var a = ['a', 'b', 'c', 'd'];
  21.  * var b = ['b', 'c'];
  22.  *
  23.  * console.log(diff(a, b))
  24.  * //=> ['a', 'd']
  25.  * ```
  26.  *
  27.  * @param  {Array} `a`
  28.  * @param  {Array} `b`
  29.  * @return {Array}
  30.  * @api public
  31.  */
  32.  
  33. function diff(arr, arrays) {
  34.   var argsLen = arguments.length;
  35.   var len = arr.length, i = -1;
  36.   var res = [], arrays;
  37.  
  38.   if (argsLen === 1) {
  39.     return arr;
  40.   }
  41.  
  42.   if (argsLen > 2) {
  43.     arrays = flatten(slice.call(arguments, 1));
  44.   }
  45.  
  46.   while (++i < len) {
  47.     if (!~arrays.indexOf(arr[i])) {
  48.       res.push(arr[i]);
  49.     }
  50.   }
  51.   return res;
  52. }
  53.  
  54. /**
  55.  * Expose `diff`
  56.  */
  57.  
  58. module.exports = diff;
  59.  
downloadindex.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top