Skip to content

Releases: dphilipson/transducist

v2.2.0

Choose a tag to compare

@dphilipson dphilipson released this 10 Feb 19:06

New Features

  • Now takes TypeScript type guards into account when using filter, remove, takeWhile, and find. For example,

    function isNumber(x: unknown): x is number {
        return typeof x === "number";
    }
    
    chainFrom(["a", 1, "b", 2])
        .filter(isNumber)
        .toArray();
    // Return type inferred as number[], previously (string | number)[].

    Thanks to @icehaunter for the suggestion!

v2.1.2

Choose a tag to compare

@dphilipson dphilipson released this 03 Jan 23:41

Bug fixes

  • Fixes the CommonJS build, which was incorrectly being built the same way as the ES modules build.

v2.1.1

Choose a tag to compare

@dphilipson dphilipson released this 27 Dec 03:03

Bug fixes

  • Fixed TypeScript return type on .max() and .min().

v2.1.0

Choose a tag to compare

@dphilipson dphilipson released this 09 Dec 02:58

New features

  • Added .flatten() transform.

v2.0.0

Choose a tag to compare

@dphilipson dphilipson released this 04 Dec 19:56

Many improvements to typing and some new goodies. 🎉

New features

  • Chains now have .sum(), .min, .max(), and .average() methods. Previously, to use this functionality one would write

    chainFrom([1, 2, 3]).reduce(toSum()); // -> 6

    Now this can be written with the more ergonomic

    chainFrom([1, 2, 3]).sum(); // -> 6

    This is now possible to make typesafe because of TypeScript's (relatively) new conditional types.

  • Add new helpers for creating iterables: range, repeat, iterate, and cycle.

  • .toObject() and .toObjectGroupBy() now accept numeric or symbol keys. Previously, only strings were accepted, which led to awkward string conversions when specifying the key:

    chainFrom([{ id: 1, name: "asteele" }, { id: 2, name: "kkavanagh" }])
        .toObject(u => u.id + "", u => u.name)
        .toArray(); // -> { 1: "asteele", 2: "kkavanagh" }

    Now this can be written without the extra string conversion:

    chainFrom([{ id: 1, name: "asteele" }, { id: 2, name: "kkavanagh" }])
        .toObject(u => u.id , u => u.name)
        .toArray(); // -> { 1: "asteele", 2: "kkavanagh" }

Breaking Changes

  • rangeIterator() has been removed in favor of range(). Note that range() differs from rangeIterator() in that it returns an Iterable instead of an Iterator. This has the advantage that it can be reused (the old rangeIterable could only be consumed once), but it is a breaking change if your code directly called iterator methods.

  • Standalone toMax(), toMin(), toSum(), and toAverage() reductions renamed to max(), min(), sum, and average() respectively, to be consistent with the new chain methods.

Fix ESModule vs CommonJS build issue

Choose a tag to compare

@dphilipson dphilipson released this 18 Apr 19:50

The ESM build was incorrectly being built as CommonJS, now fixed.

Use "module" field in package.json to automatically choose ES modules vs CommonJS

Choose a tag to compare

@dphilipson dphilipson released this 28 Mar 20:31
v1.0.3

v1.0.3

v1.0.2

Choose a tag to compare

@dphilipson dphilipson released this 15 Dec 00:44

Minor build fixes

  • CommonJS distribution now marks classes as /**@__PURE__**/, just as the ES2015 distribution does.

v1.0.1

Choose a tag to compare

@dphilipson dphilipson released this 09 Nov 23:17

(Deprecated) Also distribute CommonJS module

By default, Transducist uses ES modules in order to take advantage of tree shaking optimizations in Webpack or Rollup, but this is inconvenient for use in Node environments. We now provide a CommonJS distribution as well, available as

const { chainFrom } = require("transducist/cjs");

This feature has since been deprecated. package.json is now configured to automatically use CommonJS when needed.

v1.0.0

Choose a tag to compare

@dphilipson dphilipson released this 05 Oct 22:59

1.0.0 is Here 🎉

The API of this library hasn't changed for some time, and it has seen extensive production use since the last release. The time has come to announce 1.0.0 and commit to stability.

No changes since the previous version.