0.6.0 • Published 7 years ago
inspect-attrs v0.6.0
inspect-attrs
An object attributes inspect tool.
API
inspectAttrs(source: Object, rules: Object)
source: The target objectrules: The inspect rules
required:BooleanSet attr is requiredtype:String|ArraySet attr typedefault:AnySet attr default valueonRequired:StringSet custom required error message,%sequal the attronTypeError:StringSet custom type error message,%sequal 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]
}
});