swc/bundler/tests/.cache/deno/5c466c27276caaa226fe2b59ba8c27764348cd54.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

42 lines
1.0 KiB
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/xprod.js
import _curry2 from './internal/_curry2.js';
/**
* Creates a new list out of the two supplied by creating each possible pair
* from the lists.
*
* @func
* @memberOf R
* @since v0.1.0
* @category List
* @sig [a] -> [b] -> [[a,b]]
* @param {Array} as The first list.
* @param {Array} bs The second list.
* @return {Array} The list made by combining each possible pair from
* `as` and `bs` into pairs (`[a, b]`).
* @example
*
* R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
* @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]]
*/
var xprod = _curry2(function xprod(a, b) { // = xprodWith(prepend); (takes about 3 times as long...)
var idx = 0;
var ilen = a.length;
var j;
var jlen = b.length;
var result = [];
while (idx < ilen) {
j = 0;
while (j < jlen) {
result[result.length] = [a[idx], b[j]];
j += 1;
}
idx += 1;
}
return result;
});
export default xprod;