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 system. It is developed to power our online editing platform [Substance](http://substance.io).

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