nl_tokens: / * -------------------------------------------------------------------------- The base implementation of _ . clone without argument juggling or support for thisArg binding .
pl_tokens: function baseClone ( value , deep , callback , stackA , stackB ) { if ( callback ) { var result = callback ( value ) ; if ( typeof result != 'undefined' ) { return result ; } } // inspect [[Class]] var isObj = isObject ( value ) ; if ( isObj ) { var className = toString . call ( value ) ; if ( ! cloneableClasses [ className ] ) { return value ; } var ctor = ctorByClass [ className ] ; switch ( className ) { case boolClass : case dateClass : return new ctor ( + value ) ; case numberClass : case stringClass : return new ctor ( value ) ; case regexpClass : result = ctor ( value . source , reFlags . exec ( <mask> ) ) ; result . lastIndex = value . lastIndex ; return result ; } } else { return value ; } var isArr = isArray ( value ) ; if ( deep ) { // check for circular references and return corresponding clone var initedStack = ! stackA ; stackA || ( stackA = getArray ( ) ) ; stackB || ( stackB = getArray ( ) ) ; var length = stackA . length ; while ( length -- ) { if ( stackA [ length ] == value ) { return stackB [ length ] ; } } result = isArr ? ctor ( value . length ) : { } ; } else { result = isArr ? slice ( value ) : assign ( { } , value ) ; } // add array properties assigned by `RegExp#exec` if ( isArr ) { if ( hasOwnProperty . call ( value , 'index' ) ) { result . index = value . index ; } if ( hasOwnProperty . call ( value , 'input' ) ) { result . input = value . input ; } } // exit for shallow clone if ( ! deep ) { return result ; } // add the source value to the stack of traversed objects // and associate it with its clone stackA . push ( value ) ; stackB . push ( result ) ; // recursively populate clone (susceptible to call stack limits) ( isArr ? forEach : forOwn ) ( value , function ( objValue , key ) { result [ key ] = baseClone ( objValue , deep , callback , stackA , stackB ) ; } ) ; if ( initedStack ) { releaseArray ( stackA ) ; releaseArray ( stackB ) ; } return result ; }