zwitch is a small JavaScript package that lets you “switch” on a field value from objects, dispatching to a handler function based on a specified key. It is useful for mapping one AST to another, handling known keys, and providing special handlers for invalid or unknown values.
Project status
- Wooorm/zwitch appears to be in low activity: the most recent upstream push and updates are from 2022-11-16, and the provided history shows no newer updates after that date.
- The apparent update cadence is sparse, with updates clustered in mid-November 2022 (2.0.3 then 2.0.4) and a much longer gap before that (next older update, 2.0.2, dated 2021-04-02).
AI summary generated Today
Recent updates
2.0.4
11/16/2022Release 2.0.4 is a small change intended to address a missing coercion in the `zwitch` dispatcher. It updates how the property value `value[key]` is converted before being used to select a handler.
2.0.3
11/14/2022Release 2.0.3 is mainly described as documentation improvements and TypeScript type fixes. The diff also shows some tooling and configuration changes to strengthen typing and CI, and it includes a subtle runtime behavior change in how the discriminant field is matched.
2.0.2
4/2/2021Release 2.0.2 focuses on improving TypeScript typing so `zwitch` can infer return types from the handler functions you pass in. The code diff also shows build and tooling changes that shift declaration generation behavior and introduce stricter type coverage checks.
Features2.0.1
3/10/2021Release 2.0.1 makes type-only improvements for zwitch, focusing on replacing imprecise `any` types with `unknown`. The runtime behavior and API shape are not changed; documentation and test JSDoc were updated to match the stricter typings.
Breaking2.0.0
3/9/2021Release 2.0.0 converts zwitch to ESM and adds JSDoc-based type declarations. The diff shows a more substantial package and API surface change than the two-line release notes suggest, including changes to exports, published artifacts, and build tooling.
BreakingFeatures1.0.5
1/25/2020The release notes only state a prose refactor. The code diff indicates this release also updates development tooling configuration and dependency versions, plus adds a funding configuration file and adjusts README formatting headings and code fence languages.
1.0.4
5/9/2019Release 1.0.4 primarily updates project metadata and documentation, adding more README badges and switching author and documentation URLs from HTTP to HTTPS. The repository also renames LICENSE to license. The code diff shows several additional, maintenance-level changes (CI matrix and build/tooling pipeline) that are not mentioned in the release notes.
Features1.0.3
4/21/2018Release 1.0.3 is documented only as a code-style refactor. The diff shows mostly formatting changes in the library source, but it also includes non-trivial tooling and CI configuration changes plus devDependency/version bumps that can affect contributors and build outputs.
1.0.2
7/18/2017Release 1.0.2 removes the runtime dependency `x-is-object` and updates the README formatting. The code diff also changes how `factory(key, options)` decides whether an input `value` is eligible for `key`-based property inspection.
1.0.1
6/19/2017Release 1.0.1 mainly removes an old runtime dependency, with additional cleanup around documentation (including removing history.md). The code changes are small but include a behavioral tweak in how properties are detected, plus CI and build tooling updates that are not mentioned in the release notes.