mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 00:52:29 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_flatCat.js
|
|
|
|
|
|
import _forceReduced from './_forceReduced.js';
|
|
import _isArrayLike from './_isArrayLike.js';
|
|
import _reduce from './_reduce.js';
|
|
import _xfBase from './_xfBase.js';
|
|
|
|
var preservingReduced = function(xf) {
|
|
return {
|
|
'@@transducer/init': _xfBase.init,
|
|
'@@transducer/result': function(result) {
|
|
return xf['@@transducer/result'](result);
|
|
},
|
|
'@@transducer/step': function(result, input) {
|
|
var ret = xf['@@transducer/step'](result, input);
|
|
return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;
|
|
}
|
|
};
|
|
};
|
|
|
|
var _flatCat = function _xcat(xf) {
|
|
var rxf = preservingReduced(xf);
|
|
return {
|
|
'@@transducer/init': _xfBase.init,
|
|
'@@transducer/result': function(result) {
|
|
return rxf['@@transducer/result'](result);
|
|
},
|
|
'@@transducer/step': function(result, input) {
|
|
return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input);
|
|
}
|
|
};
|
|
};
|
|
|
|
export default _flatCat;
|