inspect-attrs

0.6.0 • Public • Published

inspect-attrs

An object attributes inspect tool.

NPM Version Download Status Linux Status Windows Status Test Coverage Node Version Dependencies

API

inspectAttrs(source: Object, rules: Object)

  • source: The target object
  • rules: The inspect rules
    • required: Boolean Set attr is required
    • type: String|Array Set attr type
    • default: Any Set attr default value
    • onRequired: String Set custom required error message, %s equal the attr
    • onTypeError: String Set custom type error message, %s equal the attr

Example

import inspectAttrs from 'inspect-attrs';
 
let options = {};
 
options = inspectAttrs(options, {
  root: {
    type: String,
    required: true
  },
  'css.loader': {
    default: null,
    type: [Function, null]
  }
});

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i inspect-attrs

    Weekly Downloads

    2

    Version

    0.6.0

    License

    MIT

    Unpacked Size

    9.26 kB

    Total Files

    6

    Last publish

    Collaborators

    • nuintun