inspect-attrs
v0.6.0
Published
An object attributes inspect tool.
Downloads
8
Maintainers
Readme
inspect-attrs
An object attributes inspect tool.
API
inspectAttrs(source: Object, rules: Object)
source
: The target objectrules
: The inspect rules
required
:Boolean
Set attr is requiredtype
:String|Array
Set attr typedefault
:Any
Set attr default valueonRequired
:String
Set custom required error message,%s
equal the attronTypeError
: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]
}
});