ts-prime
Version:
A utility library for JavaScript and Typescript.
23 lines (22 loc) • 779 B
JavaScript
import { flatMapRecord } from './flatMapRecord';
import { pipe } from './pipe';
describe('data first', function () {
test('should flatMap', function () {
expect(flatMapRecord({ a: 1, b: 2, c: 3 }, function (_a) {
var k = _a[0], v = _a[1];
return [
[k, v * 2],
[k.toUpperCase(), v * 3],
];
})).toEqual({ A: 3, B: 6, C: 9, a: 2, b: 4, c: 6 });
});
test('should flatMap with pipe', function () {
expect(pipe({ a: 1, b: 2, c: 3 }, flatMapRecord(function (_a) {
var k = _a[0], v = _a[1];
return [
[k, v * 2],
[k.toUpperCase(), v * 3],
];
}))).toEqual({ A: 3, B: 6, C: 9, a: 2, b: 4, c: 6 });
});
});