37 lines
661 B
JavaScript
37 lines
661 B
JavaScript
const unknownProp = null;
|
|
const numericProp = [Number, String];
|
|
const truthProp = {
|
|
type: Boolean,
|
|
default: true
|
|
};
|
|
const makeRequiredProp = (type) => ({
|
|
type,
|
|
required: true
|
|
});
|
|
const makeArrayProp = () => ({
|
|
type: Array,
|
|
default: () => []
|
|
});
|
|
const makeNumberProp = (defaultVal) => ({
|
|
type: Number,
|
|
default: defaultVal
|
|
});
|
|
const makeNumericProp = (defaultVal) => ({
|
|
type: numericProp,
|
|
default: defaultVal
|
|
});
|
|
const makeStringProp = (defaultVal) => ({
|
|
type: String,
|
|
default: defaultVal
|
|
});
|
|
export {
|
|
makeArrayProp,
|
|
makeNumberProp,
|
|
makeNumericProp,
|
|
makeRequiredProp,
|
|
makeStringProp,
|
|
numericProp,
|
|
truthProp,
|
|
unknownProp
|
|
};
|