UNPKG

@pnp/spfx-controls-react

Version:

Reusable React controls for SharePoint Framework solutions

27 lines 908 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nextUuid = nextUuid; exports.resetNextUuid = resetNextUuid; exports.assertValidHtmlId = assertValidHtmlId; var DEFAULT = 0; var counter = DEFAULT; function nextUuid() { var current = counter; counter = counter + 1; return "raa-".concat(current); } function resetNextUuid() { counter = DEFAULT; } // HTML5 ids allow all unicode characters, except for ASCII whitespaces // https://infra.spec.whatwg.org/#ascii-whitespace // eslint-disable-next-line no-control-regex var idRegex = /[\u0009\u000a\u000c\u000d\u0020]/g; function assertValidHtmlId(htmlId) { if (htmlId === '' || idRegex.test(htmlId)) { console.error("uuid must be a valid HTML5 id but was given \"".concat(htmlId, "\", ASCII whitespaces are forbidden")); return false; } return true; } //# sourceMappingURL=uuid.js.map