Skip to content

v1.2.0

Choose a tag to compare

@alexrqs alexrqs released this 07 Aug 06:07
· 2 commits to master since this release

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