jsonQ.js
function(index, valObj, clone) {
            var current = this.jsonQ_current;
            //return if incorrect index is given
            if (isNaN(index) && index != "first" && index != "last") {
                error(index + 'is not a valid index.');
                return this;
            }

            for (var i = 0, ln = current.length; i < ln; i++) {
                var pathC = current[i].path.concat([]),
                    lastKey = pathC.pop(),
                    parRef = this.pathValue(pathC),
                    type = objType(parRef[lastKey]),
                    objLn = parRef[lastKey].length;


                //to limit index
                var idx = index < 0 || index == "first" ? 0 : index > objLn || index == "last" ? objLn : index;


                //if array push
                if (type == 'array') {
                    valObj = clone ? jsonQ.clone(valObj) : valObj;

                    parRef[lastKey].splice(idx, 0, valObj);
                }

                //if string concatenate , if number add
                else if (type == 'string') {
                    var str = parRef[lastKey];
                    parRef[lastKey] = str.substring(0, idx) + valObj + str.substring(idx, objLn);
                }


            }
            return this;

        }
function(index, valObj, clone) {
            var current = this.jsonQ_current;
            //return if incorrect index is given
            if (isNaN(index) && index != "first" && index != "last") {
                error(index + 'is not a valid index.');
                return this;
            }

            for (var i = 0, ln = current.length; i < ln; i++) {
                var pathC = current[i].path.concat([]),
                    lastKey = pathC.pop(),
                    parRef = this.pathValue(pathC),
                    type = objType(parRef[lastKey]),
                    objLn = parRef[lastKey].length;


                //to limit index
                var idx = index < 0 || index == "first" ? 0 : index > objLn || index == "last" ? objLn : index;


                //if array push
                if (type == 'array') {
                    valObj = clone ? jsonQ.clone(valObj) : valObj;

                    parRef[lastKey].splice(idx, 0, valObj);
                }

                //if string concatenate , if number add
                else if (type == 'string') {
                    var str = parRef[lastKey];
                    parRef[lastKey] = str.substring(0, idx) + valObj + str.substring(idx, objLn);
                }


            }
            return this;

        }
function ( index , valObj , clone ) { var current = this . jsonQ_current ; //return if incorrect index is given if ( isNaN ( index ) && index != "first" && index != "last" ) { error ( index + 'is not a valid index.' ) ; return this ; } for ( var i = 0 , ln = current . length ; i < ln ; i ++ ) { var pathC = current [ i ] . path . concat ( [ ] ) , lastKey = pathC . pop ( ) , parRef = this . pathValue ( pathC ) , type = objType ( parRef [ lastKey ] ) , objLn = parRef [ lastKey ] . length ; //to limit index var idx = index < 0 || index == "first" ? 0 : index > objLn || index == "last" ? objLn : index ; //if array push if ( type == 'array' ) { valObj = clone ? jsonQ . clone ( valObj ) : valObj ; parRef [ lastKey ] . splice ( idx , 0 , valObj ) ; } //if string concatenate , if number add else if ( type == 'string' ) { var str = parRef [ lastKey ] ; parRef [ lastKey ] = str . substring ( 0 , idx ) + valObj + str . substring ( idx , objLn ) ; } } return this ; }
to append at specific index of values of current
to append at specific index of values of current