Get started with transducers.js CDN
BSD-2-Clause licensed
Functional library offers higher-order transformations and reductions for JS data structures.
Tags:- browser
- client
- functional
- util
Stable version
Copied!
How to start using transducers.js CDN
// Include the transducers library from the CDN
const T = require('transducers/src/transducers');
// Sample data
const numbers = [1, 2, 3, 4, 5];
// Define map and filter transducers
const mapTransducer = T.map(x => x * 2);
const filterTransducer = T.filter(x => x % 2 === 0);
// Apply map-filter transducer sequence
const result = T.reduce(numbers, T.compose(mapTransducer, filterTransducer), []);
// Print the result
console.log(result); // [4, 8]
Copied!
Copied!
Copied!