Nothing Particularly Magnificent

    tn-nest
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    Bundle Size - 2.30 Kb gzipped

    Usage

    const nestAlpha = createNest('local', 'alpha', {
      nested: { inside: createEgg<TYPE>(defval, EggConditions, logging) },
      union: createUnionEgg<'time' | 77 | false>('time', { includes: [false, 77, 'time'] })
    })
    const nestBeta = createNest('session', 'beta', { ... })
    const nestGama = createNest('memory', 'gama', { ... })
    
    export const $nest = {
      alpha: nestAlpha,
      beta: nestBeta,
      gama: nestGama
    }

    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[]
        }

    Install

    npm i tn-nest

    DownloadsWeekly Downloads

    12

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    51.8 kB

    Total Files

    50

    Last publish

    Collaborators

    • avatar