UNPKG

@papb/json-excel

Version:

Create a pretty Excel table from JSON data with a very simple API

24 lines 902 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertValidSheetNames = void 0; function assertValidSheetName(name) { if (name === '') { throw new TypeError('Sheet name cannot be empty.'); } if (name.length > 31) { throw new TypeError('Sheet name cannot exceed 31 characters.'); } if (/[':\\/?*[\]]/.test(name)) { throw new TypeError('Sheet name cannot include any of the following characters: []\':\\/?*'); } } function assertValidSheetNames(names) { for (const name of names) { assertValidSheetName(name); } if (names.length !== [...new Set(names.map(name => name.toLowerCase()))].length) { throw new TypeError('Two sheets cannot have the same name (case-insensitive).'); } } exports.assertValidSheetNames = assertValidSheetNames; //# sourceMappingURL=assert-valid-sheet-names.js.map