mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
30 lines
926 B
TypeScript
30 lines
926 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_xdropRepeatsWith.js
|
|
|
|
|
|
import _curry2 from './_curry2.js';
|
|
import _xfBase from './_xfBase.js';
|
|
|
|
|
|
function XDropRepeatsWith(pred, xf) {
|
|
this.xf = xf;
|
|
this.pred = pred;
|
|
this.lastValue = undefined;
|
|
this.seenFirstValue = false;
|
|
}
|
|
|
|
XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init;
|
|
XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result;
|
|
XDropRepeatsWith.prototype['@@transducer/step'] = function(result, input) {
|
|
var sameAsLast = false;
|
|
if (!this.seenFirstValue) {
|
|
this.seenFirstValue = true;
|
|
} else if (this.pred(this.lastValue, input)) {
|
|
sameAsLast = true;
|
|
}
|
|
this.lastValue = input;
|
|
return sameAsLast ? result : this.xf['@@transducer/step'](result, input);
|
|
};
|
|
|
|
var _xdropRepeatsWith = _curry2(function _xdropRepeatsWith(pred, xf) { return new XDropRepeatsWith(pred, xf); });
|
|
export default _xdropRepeatsWith;
|