Mercurial > nebulaweb3
comparison default/node_modules/shoestring/src/core/inarray.js @ 0:1d038bc9b3d2 default tip
Up:default
author | Liny <dev@neowd.com> |
---|---|
date | Sat, 31 May 2025 09:21:51 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1d038bc9b3d2 |
---|---|
1 //>>excludeStart("exclude", pragmas.exclude); | |
2 define([ "shoestring" ], function(){ | |
3 //>>excludeEnd("exclude"); | |
4 | |
5 /** | |
6 * Check for array membership. | |
7 * | |
8 * @param {object} needle The thing to find. | |
9 * @param {object} haystack The thing to find the needle in. | |
10 * @return {boolean} | |
11 * @this window | |
12 */ | |
13 shoestring.inArray = function( needle, haystack ){ | |
14 var isin = -1; | |
15 for( var i = 0, il = haystack.length; i < il; i++ ){ | |
16 if( haystack.hasOwnProperty( i ) && haystack[ i ] === needle ){ | |
17 isin = i; | |
18 } | |
19 } | |
20 return isin; | |
21 }; | |
22 | |
23 //>>excludeStart("exclude", pragmas.exclude); | |
24 }); | |
25 //>>excludeEnd("exclude"); |