Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
add model solution
Commit Description:
add model solution
// false -> Array#indexOf
// true -> Array#includes
var toIObject = require ( './_to-iobject' );
var toLength = require ( './_to-length' );
var toAbsoluteIndex = require ( './_to-absolute-index' );
module . exports = function ( IS_INCLUDES ) {
return function ( $this , el , fromIndex ) {
var O = toIObject ( $this );
var length = toLength ( O . length );
var index = toAbsoluteIndex ( fromIndex , length );
var value ;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if ( IS_INCLUDES && el != el ) while ( length > index ) {
value = O [ index ++ ];
// eslint-disable-next-line no-self-compare
if ( value != value ) return true ;
// Array#indexOf ignores holes, Array#includes - not
} else for (; length > index ; index ++ ) if ( IS_INCLUDES || index in O ) {
if ( O [ index ] === el ) return IS_INCLUDES || index || 0 ;
} return ! IS_INCLUDES && - 1 ;
};
};
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings