@thi.ng/transducers
Version:
Collection of ~170 lightweight, composable transducers, reducers, generators, iterators for functional data transformations
7 lines (6 loc) • 342 B
JavaScript
import { concat } from "./concat.js";
import { repeat } from "./repeat.js";
const padSides = (src, x, numLeft = 1, numRight = numLeft) => numLeft > 0 ? numRight > 0 ? concat(repeat(x, numLeft), src, repeat(x, numRight)) : concat(repeat(x, numLeft), src) : numRight > 0 ? concat(src, repeat(x, numRight)) : concat(src);
export {
padSides
};