UNPKG
kingraph
Version:
latest (0.3.2)
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
Plots family trees using JavaScript and Graphviz
kingraph
/
lib
/
id_generator.js
14 lines
(11 loc)
•
253 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function
idGen
(
) {
var
ids = {};
return
function
(
key
) {
if
(
typeof
ids[key] ===
'undefined'
) {
return
(ids[key] =
0
); }
else
{
return
++ids[key]; } }; }
module
.
exports
= idGen;