deep-clone-and-serialize
Version:
Deep clone and/or serialize almost any JavaScript object tree (Map/Set, RegExp, DataView, etc.) while preserving circular references.
14 lines (12 loc) • 332 B
JavaScript
//global
var id=0
export var getId=()=>id++
export var prefixId=(string)=>id++ +'_'+string
export var postfixId=(string)=>string+'_'+id++
//instance
export var GetIDGenerator=function(){
var id=0
this.getId=()=>id++
this.prefixId=(string)=>id++ +'_'+string
this.postfixId=(string)=>string+'_'+id++
}