- changed: When we receive an unexpected value, include the actual received value in the error message.
- fixed: Change the CommonJS file extension back to "js", to work better with bundlers like Metro.
- fixed: Update package.json to work with recent versions of Webpack, Rollup, and TypeScript.
- fixed: Get Deno working again by adding file extensions to all import statements.
- added: Accept fallback functions for
asOptional
andasMaybe
, to generate fresh fallback values each time there is a problem.
- changed: Add more variants to the
asEither
Flow type, up to 16 arguments.
- added: Add an
asTuple
cleaner for fixed-length arrays.
- changed: Use
asValue
to clean enum types, by allowing it to take multiple arguments.
- changed: Return
any
from uncleaners. This mirrors the idea that cleaners acceptany
. - fixed: Correct documentation typos.
- added: Add an
asValue
cleaner. - changed: Allow
asEither
to take any number of arguments.
- Expand the readme into an https://cleaners.js.org website.
- Move the documentation comments into the
.d.ts
file so they can appear in tooltips. - Add the
asCodec
anduncleaner
functions.
- Re-work the asObject cleaner.
- When passed a single cleaner function, create a key-value cleaner like
asMap
. - When passed a shape object, also include a
withRest
method on the generated cleaner. This method cleans the object according to the shape, but also preserves unknown properties if present.
- When passed a single cleaner function, create a key-value cleaner like
- Deprecate
asMap
, sinceasObject
handles this use-case now.
- Help Deno find the Typescript definitions correctly.
- Upgrade build tooling.
- Add readme section headers.
- Simplify the error location algorithm. Error object no longer receive a helper function, just a simple number property now.
- Add the package to deno.land, in addition to NPM.
- Add an optional fallback to the
asMaybe
cleaner - Fix the
asOptional
Flow types to match the TypeScript ones, where the fallback and cleaner types must match. - Add package.json to the Node.js exports table, to fix warnings in the React Native bundler.
- Document the problem with exporting cleaners under Flow.
- Export the
ObjectCleaner
type definition.
- Add an
asMaybe
cleaner, which turns invalid data intoundefined
.
- fixed: Stop the Node 14 module entry point from instantly erroring.
- fixed: Adjust the object cleaner type definitions to give better tooltips & errors.
- Add an
asJSON
cleaner. - Expose the
asObject
input shape as ashape
property on the returned cleaner. - Use an
Error.addStep
method to build up error locations, instead of fragile search & replace. Several cleaners now add a defaultaddStep
methods toError
objects do not have one. - Add a native module entry point for Node 14.
- Add an
asUnknown
cleaner. - Improve error handling.
- When a nested cleaner throws an error, add location information to the message.
- The
asOptional
fallback type must match the main type (for TypeScript only).
- Fix the
asOptional
TypeScript definition broken in v0.1.3. - Test the type definitions so they won't break in the future.
- Add an
asMap
compound cleaner.
- Add missing
package.json
fields, so TypeScript can find our definitions.
- Export the correct
Cleaner
type in the Flow definitions.
- Initial release