Skip to content

Releases: ahrjarrett/any-ts

v0.48.0

17 Aug 17:47
9a90790
Compare
Choose a tag to compare

Minor Changes

  • #169 648a8de Thanks @ahrjarrett! - ### breaking changes
    • All of the members of Universal namespace have changed their implementations
      • Since any-ts is still pre v1.0, this is a minor version bump.
      • The API is relatively stable; I expect one (1) more breaking change before releasing v1.0.0 this fall

v0.47.4

21 Jul 02:57
1285c37
Compare
Choose a tag to compare

Patch Changes

v0.47.3

23 Jun 03:00
7a407d3
Compare
Choose a tag to compare

Patch Changes

v0.47.2

23 Jun 01:54
58becea
Compare
Choose a tag to compare

Patch Changes

v0.47.1

23 Jun 01:44
9e9893c
Compare
Choose a tag to compare

Patch Changes

v0.47.0

23 Jun 01:26
73d3411
Compare
Choose a tag to compare

Minor Changes

  • #157 9fb7871 Thanks @ahrjarrett! - break: renames match.finite* to match.finite.*

    for example:

    match.finiteArray -> match.finite.array
    match.nonfiniteArray -> match.nonfinite.array
    

Patch Changes

v0.46.0

22 Jun 20:44
a00d3fb
Compare
Choose a tag to compare

Minor Changes

  • bf5df0f: ### new features

    • added match, a namespace for advanced pattern matching
    • added any.functions to describe any array of functions

    breaking changes

    a few members of the some namespace behave differently than before:

    • some.keyOf: this change was made to support a homomorphic object.map function
      that operates on both arrays and objects, preserves structure in either case.

      An example implementation:

      /**
       * {@link map `map [overload 1/2]`} ("data-last")
       *
       * [TypeScript playground](https://tsplay.dev/weA2Yw)
       *
       * {@link map `map`} takes two arguments:
       * 1. a function
       * 2. a composite data structure that contains one or more targets to apply the function to
       *
       * A unique feature of this implementation is its polymorphism: it doesn't care whether the
       * composite data structure is an array, or whether it's an object. It will apply the argument
       * to each of the children, and will preserve the structure of the original shape.
       *
       * **Trade-off:** the data-last overload of {@link map `map`} is optimized for function composition.
       * It works best when used inside a call to {@link fn.pipe `fn.pipe`} or {@link fn.flow `fn.flow`}.
       * It comes with greater potential for code re-use, at the cost of slightly slower performance.
       *
       * **Ergonomics:** if you'd prefer to provide both arguments at the same time, see overload #2.
       */
      export function map<const xs, target>(
        fn: (x: xs[some.keyof<xs>], ix: some.keyof<xs>, xs: xs) => target
      ): (xs: xs) => { [ix in keyof xs]: target };
      /**
       * {@link map `map [overload 2/2]`} ("data-first")
       *
       * [TypeScript playground](https://tsplay.dev/weA2Yw)
       *
       * {@link map `map`} is a polymorphic function that accepts a function and a data structure (such
       * as an array or object) to apply the function to.
       *
       * A unique feature of this implementation is its ability to abstract away the type of the data
       * structure it maps the function over; whether you pass it an object or an array, it will handle
       * applying the function to the data strucuture's values and returning a data structure whose type
       * corresponds 1-1 with the type of input.
       *
       * **Trade-off:** the data-first overload of {@link map `map`} evaluates eagerly. It comes with
       * slightly better performance than the data-last overload, at the cost of reusability.
       *
       * **Ergonomics:** if you'd prefer to use {@link map `map`} in a pipeline, see overload #1.
       */
      export function map<const xs, target>(
        xs: xs,
        fn: (x: xs[some.keyof<xs>], xs: xs) => target
      ): { [ix in keyof xs]: target };
      // impl.
      export function map<const xs, target>(
        ...args:
          | [fn: (x: xs[some.keyof<xs>], ix: some.keyof<xs>, xs: xs) => target]
          | [
              xs: xs,
              fn: (x: xs[some.keyof<xs>], ix: some.keyof<xs>, xs: xs) => target
            ]
      ) {
        if (args.length === 1) return (xs: xs) => map(xs, args[0]);
        else {
          const [xs, fn] = args;
          if (globalThis.Array.isArray(xs)) return xs.map(fn as never);
          else {
            let out: any.struct = {};
            for (const k in xs) out[k] = fn(xs[k] as never, k as never, xs);
            return out;
          }
        }
      }
    • some.entryOf
      slightly different semantics to support a polymorphic object.entries function

    • some.valueOf
      slightly different semantics to support a polymorphic object.values function

v0.45.2

10 Jun 15:33
d84e216
Compare
Choose a tag to compare

Patch Changes

  • 1ea3201: fix: Case.pascal and Case.camel converting all caps incorrectly
  • 58593b0: fix: removes "module" field in manifest so any-ts plays nice with Vite

v0.45.1

04 Jun 01:08
327212f
Compare
Choose a tag to compare

Patch Changes

  • d10ee8c: fix: ensure string.intercalate produces a string result

v0.45.0

01 Jun 11:24
a8a5293
Compare
Choose a tag to compare

Minor Changes

  • 5e1829b: fix: expose any_* constructors

    Fixes:

    Exported variable 'x' has or is using name 'any_dict' from external module "node_modules/any-ts/dist/index" but cannot be named.