We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibly es5-ext can be split into two packages, that will handle following scopes
es5-ext
For some supported coercible primitive types it may have following functions
coerce
null
ensure
TypeError
optional: false
undefined
errorClass: TypeError
errorMessage: "%v is not a {type}"
is
For some duck-typed object types it may have following functions
is-like
For some other object types it may have following functions
Example modules
value/is
is-value
value/ensure
ensure-value
string/is
is-string
string/coerce
string-coerce
string/ensure
string-ensure
number/is
is-number
number/integer/ensure
ensure-integer
number/natural/ensure
ensure-natural-number
array/like/is
is-array-like
array/like/ensure
array/is
Array.isArray
array/ensure
date/is
date/ensure
function/plain/is
is-plain-function
iterable/is
is-iterable
promise/is
promise/is-like
thenable/is
A standard library of extra functions and methods (including shims)
The text was updated successfully, but these errors were encountered:
medikoo
No branches or pull requests
Possibly
es5-ext
can be split into two packages, that will handle following scopes1. normalization & validation
For some supported coercible primitive types it may have following functions
coerce
- Resolves a valid value of given type and returns it. If valid value can't be resolved returnsnull
ensure
- Resolves a valid value of given type and returns it. If valid value can't be resolved throwsTypeError
exception. Supports following options:optional: false
- If value isnull
orundefined
thenensure
returnsnull
(doesn't throw)errorClass: TypeError
- Error class to useerrorMessage: "%v is not a {type}"
- Eventual error message to overrideis
- Is value a valid value of given typeFor some duck-typed object types it may have following functions
is-like
- Returns true if value matches contractensure
- Returns value if it matches contract, otherwise throwsTypeError
exceptionFor some other object types it may have following functions
is
- Returns true if value is an object of given typeensure
- Returns value if it's object of given type, otherwise throwsTypeError
exceptionExample modules
value/is
(oris-value
)value/ensure
(orensure-value
)string/is
(oris-string
)string/coerce
(orstring-coerce
)string/ensure
(orstring-ensure
)number/is
(oris-number
)number/integer/ensure
(orensure-integer
)number/natural/ensure
(orensure-natural-number
)array/like/is
(oris-array-like
)array/like/ensure
array/is
(this may be omitted as it's directly served by nativeArray.isArray
)array/ensure
date/is
date/ensure
function/plain/is
(oris-plain-function
)iterable/is
(oris-iterable
)promise/is
promise/is-like
thenable/is
2. extensions
A standard library of extra functions and methods (including shims)
The text was updated successfully, but these errors were encountered: