UNPKG

@helpscout/hsds-react

Version:

React component library for Help Scout's Design System

30 lines (25 loc) 703 B
"use strict"; exports.__esModule = true; exports.createUniqueIDFactory = createUniqueIDFactory; exports.createUniqueIndexFactory = createUniqueIndexFactory; // Source // https://github.com/Shopify/javascript-utilities/blob/master/src/other.ts function createUniqueIDFactory(prefix) { if (prefix === void 0) { prefix = ''; } var index = createUniqueIndexFactory(1); return function (prefixOverride) { var namespace = prefixOverride || prefix || ''; return "" + namespace + index(); }; } function createUniqueIndexFactory(start) { if (start === void 0) { start = 1; } var index = typeof start === 'number' ? start : 1; return function () { return index++; }; }