ts-prime
Version:
A utility library for JavaScript and Typescript.
25 lines (24 loc) • 897 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var flatMapRecord_1 = require("./flatMapRecord");
var pipe_1 = require("./pipe");
describe('data first', function () {
test('should flatMap', function () {
expect(flatMapRecord_1.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_1.pipe({ a: 1, b: 2, c: 3 }, flatMapRecord_1.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 });
});
});