mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 05:06:04 +00:00
Update std.js
This commit is contained in:
parent
ea41064aed
commit
ef7f6fb0e1
16
lib/std.js
16
lib/std.js
|
@ -251,6 +251,20 @@ function addslashes(s) {
|
|||
;
|
||||
};
|
||||
|
||||
function cartesian(arr) {
|
||||
return arr.reduce(function(a, b) {
|
||||
return a.map(function(x) {
|
||||
return b.map(function(y) {
|
||||
return x.concat([y]);
|
||||
})
|
||||
}).reduce(function(a, b) {
|
||||
return a.concat(b);
|
||||
}, []);
|
||||
}, [
|
||||
[]
|
||||
]);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Private APIs / Utility functions
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -371,4 +385,6 @@ exports.require = global.require;
|
|||
|
||||
exports.Event = StdEvent;
|
||||
exports.EventableObject = StdEventableObject;
|
||||
|
||||
exports.alert = alert;
|
||||
exports.cartesian = cartesian;
|
||||
|
|
Loading…
Reference in New Issue
Block a user