README
Bundle Size - 2.52 Kb gzipped
CreateNest
const nestAlpha = createNest('local', 'alpha', { ... })
const nestBeta = createNest('session', 'beta', { ... })
const nestGama = createNest('memory', 'gama', { ... })
export const $nest = {
alpha: nestAlpha,
beta: nestBeta,
gama: nestGama
}
createEgg
let egg = createEgg<TYPE>(defval, EggConditions, logging)
createUnionEgg
let egg = createUnionEgg('alpha', ['alpha', 'beta', 'gama'] as const)
NB: Property key in $nest
must be exactly the same as the namespace used in 2nd parameter of createNest()
Conditions
type TypeValidator = 'string' | 'number' | 'boolean' | 'array' | 'object'
type Validator<T> = (newval: T) => boolean
type Valuepair = [string | RegExp, EggConditions]
type EggConditions<T = any> =
| null
| TypeValidator
| TypeValidator[]
| Validator<T>
| {
type?: TypeValidator | TypeValidator[]
validator?: Validator<T>
includes?: any[]
valuepairs?: Valuepair[]
}