nl_tokens: ISSORTED // FUNCTION : issorted ( arr [ comparator ] ) Returns a boolean indicating if an input array is sorted .
pl_tokens: function issorted ( arr , clbk ) { if ( ! Array . isArray ( arr ) ) { throw new TypeError ( 'issorted()::invalid input argument. Must provide an array.' ) ; } if ( arguments . length > 1 ) { if ( typeof clbk !== 'function' ) { throw new TypeError ( 'issorted()::invalid input argument. Comparator must be a function.' ) ; } } var len = arr . <mask> , i ; if ( ! clbk ) { // Default: ascending order... for ( i = 0 ; i < len - 1 ; i ++ ) { if ( arr [ i ] > arr [ i + 1 ] ) { return false ; } } return true ; } // Impose arbitrary sort order... for ( i = 0 ; i < len - 1 ; i ++ ) { if ( clbk ( arr [ i ] , arr [ i + 1 ] ) > 0 ) { return false ; } } return true ; }