sjl.js
function extractFromArrayAt (array, index, type, makeCopyOfArray) {
        makeCopyOfArray = isBoolean(makeCopyOfArray) ? makeCopyOfArray : true;
        var retVal = [null, array],
            matchesType, foundElement,
            subject,
            splicedArray;
        if (array.hasOwnProperty(index + '')) {
            subject = makeCopyOfArray ? array.slice() : array;
            matchesType = issetAndOfType(type, _String) ? classOfIs(subject[index], type) : true;
            if (matchesType) {
                splicedArray = subject.splice(index, 1);
                foundElement = splicedArray.length > 0 ? splicedArray[0] : null;
                retVal = [foundElement, subject];
            }
        }
        return retVal;
    }
function extractFromArrayAt (array, index, type, makeCopyOfArray) {
        makeCopyOfArray = isBoolean(makeCopyOfArray) ? makeCopyOfArray : true;
        var retVal = [null, array],
            matchesType, foundElement,
            subject,
            splicedArray;
        if (array.hasOwnProperty(index + '')) {
            subject = makeCopyOfArray ? array.slice() : array;
            matchesType = issetAndOfType(type, _String) ? classOfIs(subject[index], type) : true;
            if (matchesType) {
                splicedArray = subject.splice(index, 1);
                foundElement = splicedArray.length > 0 ? splicedArray[0] : null;
                retVal = [foundElement, subject];
            }
        }
        return retVal;
    }
function extractFromArrayAt ( array , index , type , makeCopyOfArray ) { makeCopyOfArray = isBoolean ( makeCopyOfArray ) ? makeCopyOfArray : true ; var retVal = [ null , array ] , matchesType , foundElement , subject , splicedArray ; if ( array . hasOwnProperty ( index + '' ) ) { subject = makeCopyOfArray ? array . slice ( ) : array ; matchesType = issetAndOfType ( type , _String ) ? classOfIs ( subject [ index ] , type ) : true ; if ( matchesType ) { splicedArray = subject . splice ( index , 1 ) ; foundElement = splicedArray . length > 0 ? splicedArray [ 0 ] : null ; retVal = [ foundElement , subject ] ; } } return retVal ; }
Extracts a value at an `index` of passed in array (alternately only extract the value if it is of `type`).
Returns an array with two elements: Element `1` contains the extracted value and element `2` the resulting
array of the extraction (copy of original array with extracted element) of the value at `index`.
@function module:sjl.extractFromArrayAt
@param array {Array} - Array to extract from.
@param index {Number} - Index of element to look for in `array`.
@param type {String|Function} - Type (name or constructor) to match on.  Optional.
@param makeCopyOfArray {Boolean|Undefined} - Whether to make a copy of the array or not.  Default `true`.
@returns {Array<*,Array>} - If passed in array has an element at `index` (and alternately) element
matches `type` then returns an array with found value at index and resulting array of extraction of said value.
Else returns an array containing `null` and passed in array.
Extracts a value at an index of passed in array ( alternately only extract the value if it is of type ) . Returns an array with two elements : Element 1 contains the extracted value and element 2 the resulting array of the extraction ( copy of original array with extracted element ) of the value at index .