nl_tokens: Replace Placeholders in any JSON Member mode allow to replace object member without using the {{ }} of left part of the variables
pl_tokens: function ( json , variables , memberMode , callback ) { if ( typeof memberMode == 'function' ) { callback = memberMode ; var member_mode = memberMode || false ; } else { var member_mode = memberMode || false ; } var str = JSON . stringify ( json ) ; var output = str . replace ( / {{\w+}} / g , function ( found ) { found = ( member_mode ) ? found . <mask> ( / [\w\.]+ / ) [ 0 ] : found ; // Traverse object var f ; traverse ( variables ) . forEach ( function ( v ) { if ( v && typeof v [ found ] != 'undefined' ) { if ( typeof v [ found ] != 'string' ) { // Stringify if not string yet f = JSON . stringify ( v [ found ] ) ; } else { f = v [ found ] || found ; } } } ) ; return f ; } ) ; // Array must have the first and last " stripped // otherwise the JSON object won't be valid on parse output = output . replace ( / "\[(.*)\]" / , '[$1]' ) ; callback ( JSON . parse ( output ) ) ; }