any-transduce

transduce, transducers-js or transducers.js: Users choice

Usage no npm install needed!

<script type="module">
  import anyTransduce from 'https://cdn.skypack.dev/any-transduce';
</script>

README

Any Transduce

Build Status

Let your transducers library support either transduce, transducers-js or transducers.js and leave the choice to the end user. The end user can npm install, or install a browser version in a <script> tag their preference before using this library and the installed library will be automatically detected. When API differs, exported functions are adapted to match transduce (which mostly follows transducers-js).

For general use, you can use any other transduce- libraries as desired directly with your preferred transducers implementation. All of these libraries can work with either implementation and can be required and used directly (and do not depend on transduce):

The transduce library may only be useful for library extensions that support any implementation. The goal is to adapt to a common interface so the end user can choose the transducer implementation.

Currently supports a common interface for the following methods:

into: function(empty, xf, coll);
transduce: function(xf, f, init, coll);
reduce: function(f, init, coll);
map: function(f);
filter: function(pred);
remove: function(pred);
take: function(n);
takeWhile: function(pred);
drop: function(n);
dropWhile: function(pred);
cat: transducer;
mapcat: function(f);
partitionAll: function(n);
partitionBy: function(f);
compose: function(/*args*/);