Skip to content

Releases

v1.2.1

Choose a tag to compare

@alexrqs alexrqs released this 07 Aug 17:24

Changed

  • Linting and formatting migrated from ESLint (airbnb-base) + Prettier to Ultracite on Biome. npm run lint now runs ultracite check; a new lint:fix script applies fixes. Config lives in biome.jsonc (single quotes and no semicolons preserved).
  • Source and tests reformatted to the Ultracite style, with small behavior-neutral refactors to satisfy its rules: bare catch for unused error bindings, for...of instead of forEach/spread-accumulating reduce in cookieJar, hoisted regex in parseTimeUnit, Date.now() in tests, alphabetized object keys.

No changes to the published API.

Full changelog: v1.2.0...v1.2.1

v1.2.0

Choose a tag to compare

@alexrqs alexrqs released this 07 Aug 06:07

Added

  • Test suite for cookieJar, parseExpireDate, parseTimeUnit and the storage wrapper (ava).
  • Named export whateverStorage factory alongside the default export, so custom storage backends can be wrapped.
  • db.cookie.removeItem(key, { domain, path }) now accepts the same options as setItem.
  • README: API notes, expires format documentation, badges and license section.
  • CHANGELOG.md.

Changed

  • Source split into testable modules.
  • Cookie values are now URI-encoded, so values containing ; or = survive the round trip.
  • Cookies no longer force domain=window.location.hostname by default; omitting domain creates a host-only cookie (and no longer crashes outside a browser).
  • All development dependencies modernized: Babel 7 stable, ava 6, eslint 8 + airbnb-base 15, prettier 3. Removed unused husky/pretty-quick and obsolete babel-preset-primavera.
  • prepublish script replaced with prepublishOnly; added lint script.
  • package.json metadata fixed: license corrected to MIT (matching the LICENSE file), description, keywords, author, repository and files whitelist added.

Fixed

  • db.cookie.clear() never removed cookies: it destructured the first character of each cookie string instead of the cookie name.
  • db.cookie.getItem() threw SyntaxError for missing cookies — it now returns null.
  • db.cookie.getItem() threw on non-JSON cookies set by other code — the raw value is now returned as-is.
  • db.cookie.removeItem() omitted the cookie path, so browsers often failed to actually delete the cookie.
  • Invalid expires strings (e.g. 'banana') produced an Invalid Date cookie expiry — they now fall back to the 1 minute default.
  • parseTimeUnit returned the wrong duration for uppercase plurals (e.g. 'DAYS').
  • getItem on local/session storage no longer throws when the stored value is not valid JSON.

Note: version 1.1.2 was staged in package.json but never published or tagged; its work (tests, module split, parser optimization) is included in this release.

Full changelog: v1.1.1...v1.2.0

v1.1.1

Choose a tag to compare

@alexrqs alexrqs released this 07 Aug 06:07

Fixed

  • db.cookie.getItem() returns the parsed object instead of the raw JSON string.

v1.1.0

Choose a tag to compare

@alexrqs alexrqs released this 07 Aug 06:07

Fixed

  • String validation when reading stored values.

v1.0.0

Choose a tag to compare

@alexrqs alexrqs released this 07 Aug 06:07

First stable release: db.local, db.session and db.cookie with setItem/getItem/removeItem/clear, JSON encoding of values, in-memory fallback when browser storage is unavailable, and human-readable cookie expires strings.