decoders

Elegant validation library for type-safe input data (for TypeScript and Flow)

MIT License

Downloads
47.8K
Stars
357
Committers
14

Bot releases are visible (Hide)

decoders -

Published by nvie over 6 years ago

  • Fix: revert accidentally emitting $ReadOnlyArray types in array decoders
decoders -

Published by nvie over 6 years ago

  • Drop support for Node 7
  • Declare inputted arrays will not be modified (treated as read-only)
decoders -

Published by nvie over 6 years ago

  • Fix type issues caused by too strict use of mixeds
decoders -

Published by nvie over 6 years ago

decoders -

Published by nvie over 6 years ago

decoders -

Published by nvie over 6 years ago

  • Upgraded debrief dependency
  • Behave better in projects that have Flow's experimental.const_params
    setting turned on
decoders -

Published by nvie over 6 years ago

  • New decoders!
    • exact() is like object(), but will fail if the inputted object contains
      superfluous keys (keys that aren't in the object definition).
decoders -

Published by nvie over 6 years ago

  • Collect and report all nested errors in an object() at once (rather than error on the first error).

Breaking:

  • Remove deprecated message argument to object()
decoders -

Published by nvie over 6 years ago

  • New decoders!
    • email validator based on the almost perfect email regex
    • url validator for validating HTTPS URLs (most common use case)
    • anyUrl validator for validating any URL scheme
decoders -

Published by nvie over 6 years ago

  • Much improved error messages! They were redesigned to look great in terminals and to summarize only the relevant bits of the error message, striking a balance between all the details and the high level summary.
decoders -

Published by nvie almost 7 years ago

  • New feature: regex(), for building custom string decoders
  • Tiny tweaks to improve error messages (more structural improvements are on the roadmap)
decoders - v1.0.0

Published by nvie almost 7 years ago

This is the first stable release, and marks a point where I'm comfortable with the public API and I expect no signature changes in it.

  • BREAKING Removes the old public ("compat") API
  • Finalize/settle on new public API
decoders -

Published by nvie almost 7 years ago

  • Breaking change New API: simplified names, split up decoders from guards.
    What used to be called "decoders" in 0.0.x ("things that either return
    a value or throw a runtime error") are now called "guards" in 0.1.0.
    The meaning of the term "decoders" is now changed to a thing that either is
    an "Ok" value or an "Err" value.

    To convert to the new API, do this:

    // Old way
    import { decodeNumber, decodeObject, decodeString } from 'decoders';
    
    const decoder = decodeObject({
        name: decodeString(),
        age: decodeNumber(),
    });
    
    // -------------------------------------------------------------------
    
    // New way
    import { guard, number, object, string } from 'decoders';
    
    const guard = guard(object({
        name: string,
        age: number,
    }));
    
decoders -

Published by nvie about 7 years ago

  • Decoders have been split up into multiple files
  • Tests were added
  • Coverage has increased a bit