Adds SFRA 6.0
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
function map() {
|
||||
var args = Array.from(arguments);
|
||||
var list = args[0];
|
||||
var callback = args[1];
|
||||
if (list && Object.prototype.hasOwnProperty.call(list, 'toArray')) {
|
||||
list = list.toArray();
|
||||
}
|
||||
return list ? list.map(callback) : [];
|
||||
}
|
||||
|
||||
function find() {
|
||||
var args = Array.from(arguments);
|
||||
var list = args[0];
|
||||
var callback = args[1];
|
||||
if (list && Object.prototype.hasOwnProperty.call(list, 'toArray')) {
|
||||
list = list.toArray();
|
||||
}
|
||||
return list ? list.find(callback) : null;
|
||||
}
|
||||
|
||||
function forEach() {
|
||||
var args = Array.from(arguments);
|
||||
var list = args[0];
|
||||
var callback = args[1];
|
||||
if (list && Object.prototype.hasOwnProperty.call(list, 'toArray')) {
|
||||
list = list.toArray();
|
||||
}
|
||||
return list ? list.forEach(callback) : null;
|
||||
}
|
||||
|
||||
function every() {
|
||||
var args = Array.from(arguments);
|
||||
var list = args[0];
|
||||
var callback = args[1];
|
||||
if (list && Object.prototype.hasOwnProperty.call(list, 'toArray')) {
|
||||
list = list.toArray();
|
||||
}
|
||||
return list ? list.every(callback) : null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
find: find,
|
||||
forEach: forEach,
|
||||
map: map,
|
||||
every: every
|
||||
};
|
Reference in New Issue
Block a user