mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 12:15:20 +08:00
dca0ff02ed
Underscore.js _.uniq(_.compact( to native Array.filter((value, index, self) => !!value && self.indexOf(value) == index) Underscore.js _.compact to native Array.filter(value => !!value) Underscore.js _.uniq to native Array.filter((value, index, self) => self.indexOf(value) == index) Underscore.js _.values to native Object.values Underscore.js _.flatten to native Array.flat Underscore.js _.union to native Array.concat + unique filter Underscore.js _.reduce to native Array.reduce Underscore.js _.escape replaced with advanced htmlspecialchars() Underscore.js _.memoize replaced Now Underscore.js is a slim custom version (only _.debounce, _.defer & _.throttle)
16 lines
418 B
JavaScript
16 lines
418 B
JavaScript
|
|
Array.prototype.flat || Object.defineProperty(Array.prototype, 'flat', {
|
|
configurable: true,
|
|
value: function flat(depth) {
|
|
depth = isNaN(depth) ? 1 : Number(depth);
|
|
return depth ? Array.prototype.reduce.call(this, (acc, cur) => {
|
|
if (Array.isArray(cur)) {
|
|
acc.push.apply(acc, flat.call(cur, depth - 1));
|
|
} else {
|
|
acc.push(cur);
|
|
}
|
|
return acc;
|
|
}, []) : this.slice();
|
|
},
|
|
writable: true
|
|
});
|