UNPKG

write-excel-file

Version:

Write simple `*.xlsx` files in a browser or Node.js

24 lines (22 loc) 868 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = validateSheetName; // https://stackoverflow.com/questions/451452/valid-characters-for-excel-sheet-names // Sheet name can't be empty. // Sheet name shouldn't exceed 31 characters. // Sheet name shouldn't contain any of the following characters: []/\:*? var ILLEGAL_CHARACTERS_IN_SHEET_NAME = /[\[\]\/\\:*?]+/; function validateSheetName(sheetName) { if (!sheetName) { throw new Error('Sheet name can\'t be empty'); } if (sheetName.length > 31) { throw new Error("Sheet name \"".concat(sheetName, "\" can't be longer than 31 characters")); } if (ILLEGAL_CHARACTERS_IN_SHEET_NAME.test(sheetName)) { throw new Error("Sheet name \"".concat(sheetName, "\" contains illegal characters: []/\\:*?")); } } //# sourceMappingURL=validateSheetName.js.map