- what's next
- NEW:
t(dateObj).isDate
- is available. - NEW:
t(Symbol('desc')).isSymbol
- is available - FIX:
getNestedObject
breaks in ESM modules
- TypeScript
index.d.ts
type changes
- FIX: Whitelist TypeScript
index.d.ts
file for npm
- NEW: TypeScript type definitions
- Added support for bracket syntax while accessing nested objects
t('someObject.firstArray[0].secondArray[0].complexObject["@id"]').isDefined
is now possible.
- Schema Validation
- Typy can validate if an object matches a specific type schema
- Custom Types
- Custom type validators can be added to Typy
This version introduces BREAKING changes (for node.js imports only). Make sure you update your code accordingly.
Before v3.0.0, t
function was imported as
const t = require('typy');
From v3.0.0, t
function should be imported as
const { t } = require('typy');
Note: Breaking changes apply only for node.js CommonJS style require statements. This version affect ES6 style imports.
- Fix: Nested arrays with length > 10 will work like a charm now
- Package minified with >60% compression
- New getters added
safeNumber
returns the value if input is Number or returns 0safeBoolean
returns the value if input is Boolean or returns falsesafeFunction
returns the function if input is function or returns an empty function () => {}
- Added support for use in TypeScript codebases
- Two new getters are available in Typy
safeObject
returns the value from a nested object path without throwingsafeString
returns the value if input is string or returns empty string
- Performance optimizations
- Typy can now store results to a variable and check the type later
- Fixed a bug for Number type validation
- Typy is released to the world =)
- Following APIs are included in the first release
isDefined
returns if the input is definedisUndefined
returns if the input is undefinedisNull
returns if the input is nullisNullOrUndefined
returns if the input is either null or undefinedisBoolean
returns if the input is a booleanisTrue
returns if the input is boolean trueisFalse
returns if the input is boolean falseisTruthy
returns if the input is truthyisFalsy
returns if the input is falsyisFalsy
returns if the input is falsyisObject
returns if the input is an object - {}isEmptyObject
returns if the input is an empty objectisString
returns if the input is a stringisEmptyString
returns if the input is an empty stringisNumber
returns if the input is a numberisArray
returns if the input is an arrayisEmptyArray
returns if the input is an empty arrayisFunction
returns if the input is a function