Socket
Socket
Sign inDemoInstall

yup

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yup - npm Package Versions

13
13

1.0.0

Diff

Changelog

Source

1.0.0 (2023-02-08)

monastic.panic
published 1.0.0-beta.8 •

Changelog

Source

1.0.0-beta.8 (2022-11-10)

Bug Fixes

  • check if field exists when generating defaults (37f686c)
  • correct minor typo in README (#1760) (62786c4)
  • don't return any for oneOf (74c5bc5), closes #1675
  • export more types (f250109)
  • string().notRequired() (#1824) (dcb4b63)
  • TS 4.8 compat (bc74c34)
  • types: undefined defaults produce optional outputs (1afbac0)

Features

BREAKING CHANGES

  • previously oneOf required adding null explicitly to allowed values when using oneOf. Folks have found this confusing and unintuitive so I am deferring and adjusting the behavior
  • Use a simpler regex for email addresses that aligns with browsers, and add docs about how to override.
monastic.panic
published 1.0.0-beta.7 •

Changelog

Source

1.0.0-beta.7 (2022-08-20)

monastic.panic
published 1.0.0-beta.5 •

Changelog

Source

1.0.0-beta.5 (2022-08-19)

Bug Fixes

Features

BREAKING CHANGES

  • The types for Lazy have changes a bit, it's unlikely that this affects anyone but it is technically a breaking change.
monastic.panic
published 1.0.0-beta.4 •

Changelog

Source

1.0.0-beta.4 (2022-04-10)

Bug Fixes

  • boolean: calling optional made it non-optional (4ba02a1), closes #1627
monastic.panic
published 1.0.0-beta.3 •

Changelog

Source

1.0.0-beta.3 (2022-03-09)

Bug Fixes

BREAKING CHANGES

  • 'required' no longer adds a test for most schema, to determine if a schema is required, check it's spec.optional and spec.nullable values, also accessible via describe()
monastic.panic
published 1.0.0-beta.2 •

Changelog

Source

1.0.0-beta.2 (2022-01-21)

Bug Fixes

Features

BREAKING CHANGES

  • The builder object version of when() requires then and otherwise to be functions (schema: Schema) => Schema.

  • The function version of when() has been changed to make it easier to type. values are always passed as an array and schema, and options always the second and third argument. this is no longer set to the schema instance. and all functions must return a schema to be type safe

 string()
-   .when('other', function (other) => {
-      if (other) return this.required()
+   .when('other', ([other], schema) => {
+     return other ? schema.required() : schema
  })
  • concat works shallowly now. Previously concat functioned like a deep merge for object, which produced confusing behavior with incompatible concat'ed schema. Now concat for objects works similar to how it works for other types, the provided schema is applied on top of the existing schema, producing a new schema that is the same as calling each builder method in order

  • docs: update readme

  • chore: update to readonly arrays and test string type narrowing

  • test: add boolean tests

  • docs: more docs

  • feat: allow mixed schema to specify type check

  • mixed schema are no longer treated as the base class for other schema types. It hasn't been for a while, but we've done some nasty prototype slinging to make it behave like it was. Now typescript types should be 1 to 1 with the actual classes yup exposes.

In general this should not affect anything unless you are extending (via addMethod or otherwise) mixed prototype.

import {
-  mixed,
+  Schema,
} from 'yup';

- addMethod(mixed, 'method', impl)
+ addMethod(Schema, 'method', impl)
  • chore: prep work for toggling coercion

  • Publish v1.0.0-alpha.4

  • chore: docs

  • feat!: add json() method and remove default object/array coercion

  • object and array schema no longer parse JSON strings by default, nor do they return null for invalid casts.

object().json().cast('{}')
array().json().cast('[]')

to mimic the previous behavior

  • feat: Make Array generic consistent with others

  • types only, ArraySchema initial generic is the array type not the type of the array element. array<T>() is still the inner type.

  • Publish v1.0.0-beta.0

  • docs

monastic.panic
published 1.0.0-beta.1 •

Changelog

Source

1.0.0-beta.1 (2022-01-03)

Features

  • flat bundles and size reductions (753abdf)
monastic.panic
published 1.0.0-beta.0 •

Changelog

Source

1.0.0-beta.0 (2021-12-29)

  • feat!: add json() method and remove default object/array coercion (94b73c4)

Features

  • Make Array generic consistent with others (a82353f)

BREAKING CHANGES

  • types only, ArraySchema initial generic is the array type not the type of the array element. array<T>() is still the inner type.
  • object and array schema no longer parse JSON strings by default, nor do they return null for invalid casts.
object().json().cast('{}')
array().json().cast('[]')

to mimic the previous behavior

monastic.panic
published 1.0.0-alpha.4 •

Changelog

Source

1.0.0-alpha.4 (2021-12-29)

Bug Fixes

Features

BREAKING CHANGES

  • mixed schema are no longer treated as the base class for other schema types. It hasn't been for a while, but we've done some nasty prototype slinging to make it behave like it was. Now typescript types should be 1 to 1 with the actual classes yup exposes.

In general this should not affect anything unless you are extending (via addMethod or otherwise) mixed prototype.

import {
-  mixed,
+  Schema,
} from 'yup';

- addMethod(mixed, 'method', impl)
+ addMethod(Schema, 'method', impl)
  • concat works shallowly now. Previously concat functioned like a deep merge for object, which produced confusing behavior with incompatible concat'ed schema. Now concat for objects works similar to how it works for other types, the provided schema is applied on top of the existing schema, producing a new schema that is the same as calling each builder method in order
  • The builder object version of when() requires then and otherwise to be functions (schema: Schema) => Schema.
  • The function version of when() has been changed to make it easier to type. values are always passed as an array and schema, and options always the second and third argument. this is no longer set to the schema instance. and all functions must return a schema to be type safe
 string()
-   .when('other', function (other) => {
-      if (other) return this.required()
+   .when('other', ([other], schema) => {
+     return other ? schema.required() : schema
  })
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc