|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
515 bytes
|
| Line | |
|---|
| 1 | var restArguments = require('./restArguments.js');
|
|---|
| 2 | var _flatten = require('./_flatten.js');
|
|---|
| 3 | var filter = require('./filter.js');
|
|---|
| 4 | var contains = require('./contains.js');
|
|---|
| 5 |
|
|---|
| 6 | // Take the difference between one array and a number of other arrays.
|
|---|
| 7 | // Only the elements present in just the first array will remain.
|
|---|
| 8 | var difference = restArguments(function(array, rest) {
|
|---|
| 9 | rest = _flatten(rest, true, true);
|
|---|
| 10 | return filter(array, function(value){
|
|---|
| 11 | return !contains(rest, value);
|
|---|
| 12 | });
|
|---|
| 13 | });
|
|---|
| 14 |
|
|---|
| 15 | module.exports = difference;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.