UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.

11 lines (10 loc) 268 B
export default function createCountingIdGenerator() { var counters = {} return function uuid(prefix) { if (!counters.hasOwnProperty(prefix)) { counters[prefix] = 1 } var result = [prefix, '-', counters[prefix]++].join('') return result } }