fadcb525308964d4782bd6182b9a69f6e53f0ec8
[platform/framework/web/crosswalk-tizen.git] /
1 'use strict';
2
3 var value    = require('../../object/valid-value')
4   , contains = require('./contains')
5   , byLength = require('./_compare-by-length')
6
7   , filter = Array.prototype.filter, push = Array.prototype.push
8   , slice = Array.prototype.slice;
9
10 module.exports = function (/*…list*/) {
11         var lists;
12         if (!arguments.length) slice.call(this);
13         push.apply(lists = [this], arguments);
14         lists.forEach(value);
15         lists.sort(byLength);
16         return lists.reduce(function (a, b) {
17                 return filter.call(a, function (x) { return contains.call(b, x); });
18         });
19 };