What's New in v3
v3 is a TypeScript rewrite. The behavior of the API is unchanged from v2 — the breaking changes are about packaging (ESM) and a set of renames that started as v2 deprecations.
Breaking Changes
Section titled “Breaking Changes”- ESM only. Notation is now an ES module. Import it with
import { Notation } from 'notation'— CommonJSrequire()is no longer supported. (Why ESM?) - Node ≥ 20 required.
exportsmap. Only the package root (notation) andpackage.jsonare importable — no deep imports intolib/.- Nested classes removed.
Notation.ErrorandNotation.Globare gone; the classes are top-level named exports now.
Renames
Section titled “Renames”Every removed member has a direct replacement with identical behavior:
| Removed (v2) | Use instead (v3) |
|---|---|
Notation.Error | NotationError |
Notation.Glob | NotationGlob |
NotationGlob#levels | NotationGlob#notes |
Notation#eachLevel() | Notation#eachNote() |
Notation#aggregate() | Notation#expand() |
Notation#delete() | Notation#remove() |
Notation#renote() | Notation#rename() |
Notation#copyToNew() | Notation#extract() |
Notation#moveToNew() | Notation#extrude() |
Notation.countLevels() | Notation.countNotes() |
Upgrading
Section titled “Upgrading”// v2const { Notation } = require('notation');const glob = new Notation.Glob('x.*');Notation.create(obj).aggregate();
// v3import { Notation, NotationGlob } from 'notation';const glob = new NotationGlob('x.*');Notation.create(obj).expand();Switch your imports to ESM, swap the renamed members per the table, and your v2 code runs unchanged. The full history is in the Changelog.