Socket
Socket
Sign inDemoInstall

simple-runtypes

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous13Next

6.0.0

Diff

Changelog

Source

6.0.0

  • change useRuntype to return a ValidationResult to support using runtypes without relying on exceptions and win in benchmarks
  • rename fail to createError
  • make isFail private, use ValidationResult.ok instead
hoeck
published 5.0.2 •

Changelog

Source

5.0.2

  • fix fail to not return any but Fail Now, custom runtypes will result in the correct inferred type of Runtype<T> instead of Runtype<any> for custom runtypes that might return a failure.
hoeck
published 5.0.1 •

Changelog

Source

5.0.1

  • fix missing error utility (getFormattedError(), ...) exports
hoeck
published 5.0.0 •

Changelog

Source

5.0.0

  • add useRuntype to call other runtypes in custom runtypes
  • rename enumValue to enum
  • remove discriminatedUnion - use the normal union instead. The discriminant key gets inferrred automatically by union now.
hoeck
published 4.1.0 •

Changelog

Source

4.1.0

  • fix error messages
  • add sloppyRecord (props to @pabra)
  • add undefined and null runtypes (props to @pabra)
hoeck
published 4.0.1 •

Changelog

Source

4.0.1

  • fix broken runtypes for string and integer due to missing return type annotations
hoeck
published 4.0.0 •

Changelog

Source

4.0.0

  • use copy-on-write for performance: they mostly just check their input object and return it unmodified. Before that, arrays and objects were always copied. Now, only if the runtype or any nested runtype modifies its input (e.g. trimming strings or custom runtypes), objects and arrays are copied.
  • stringIndex and numberIndex now err on "__proto__" and Symbol keys
hoeck
published 3.0.0 •

Changelog

Source

3.0.0

  • add explicit options (min, max, length etc.) to string, number, integer, stringAsInteger and array runtypes
  • change error messages
  • improve stringAsInteger to accept '-0' and '+123' (leading plus) as valid integer strings
hoeck
published 2.0.0 •

Changelog

Source

2.0.0

  • remove .check and make user invocations of runtypes throw exceptions (using .check turned out to be a major annoyance and I forgot it in almost half of my code bc typescript does not warn me)
  • add runtype to create custom runtypes
  • add RuntypeUsageError, thrown when the api is misused
  • add getFormattedError, getFormattedErrorPath and getFormattedErrorValue functions to extract information from RuntypeError
hoeck
published 1.0.1 •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc