wip: migrate to bun

This commit is contained in:
jdalton
2023-09-16 14:47:50 -07:00
parent 2da024c3b4
commit 97d4a2fe19
1052 changed files with 30244 additions and 26856 deletions

View File

@@ -0,0 +1,28 @@
import assert from 'node:assert';
import lodashStable from 'lodash';
import { LARGE_ARRAY_SIZE, square, isEven } from './utils';
describe('find and findLast', () => {
lodashStable.each(['find', 'findLast'], (methodName) => {
const isFind = methodName == 'find';
it(`\`_.${methodName}\` should support shortcut fusion`, () => {
let findCount = 0,
mapCount = 0,
array = lodashStable.range(1, LARGE_ARRAY_SIZE + 1),
iteratee = function (value) {
mapCount++;
return square(value);
},
predicate = function (value) {
findCount++;
return isEven(value);
},
actual = _(array).map(iteratee)[methodName](predicate);
assert.strictEqual(findCount, isFind ? 2 : 1);
assert.strictEqual(mapCount, isFind ? 2 : 1);
assert.strictEqual(actual, isFind ? 4 : square(LARGE_ARRAY_SIZE));
});
});
});