@limetech/lime-elements
Version:
43 lines (42 loc) • 710 B
JavaScript
/**
*
* @param schema
*/
export function isObjectType(schema = {}) {
return isType(schema.type, 'object');
}
/**
*
* @param schema
*/
export function isArrayType(schema) {
return isType(schema.type, 'array');
}
/**
*
* @param schema
*/
export function isStringType(schema) {
return isType(schema.type, 'string');
}
/**
*
* @param schema
*/
export function isNumberType(schema) {
return isType(schema.type, 'number');
}
/**
*
* @param schema
*/
export function isIntegerType(schema) {
return isType(schema.type, 'integer');
}
function isType(input, type) {
if (Array.isArray(input)) {
return input.includes(type);
}
return input === type;
}
//# sourceMappingURL=schema.js.map