UNPKG

obj-valid

Version:

This package can check is your object has correct structure without using typescript. As you know after transpilation interfaces disappear. If you want to check object structure on production or in clean javascript you can use this package.

21 lines 624 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayChecking = void 0; var typeCheck_1 = require("./typeCheck"); var allSameType_1 = require("./allSameType"); function arrayChecking(arr) { if (arr.length === 0) return { type: 'array', value: 'any', }; if (!allSameType_1.allSameType(arr)) { throw new Error('Array can contain only one type of values'); } return { type: 'array', value: typeCheck_1.typeCheck(arr[0]), }; } exports.arrayChecking = arrayChecking; //# sourceMappingURL=arrayChecking.js.map