An object attributes inspect tool.
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
import inspectAttrs from 'inspect-attrs';
let options = {};
options = inspectAttrs(options, {
root: {
type: String,
required: true
},
'css.loader': {
default: null,
type: [Function, null]
}
});