UNPKG

find-index-x

Version:

This method returns the index of the first element in the array that satisfies the provided testing function.

15 lines 16 kB
/*! { "author": "Graham Fairweather", "copywrite": "Copyright (c) 2017", "date": "2019-08-28T17:40:36.767Z", "describe": "", "description": "This method returns the index of the first element in the array that satisfies the provided testing function.", "file": "find-index-x.min.js", "hash": "8eb2219d8e50c9c5ce3c", "license": "MIT", "version": "3.1.2" } */ !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.findIndexX=n():t.findIndexX=n()}(function(){"use strict";var t,n={}.constructor,e=n.prototype,r=n.defineProperty,o=function(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0},i=function(){return this};try{return r?r(e,"$$globalThis$$",{get:i,configurable:!0}):e.__defineGetter__("$$globalThis$$",i),t="undefined"==typeof $$globalThis$$?o():$$globalThis$$,delete e.$$globalThis$$,t}catch(t){return o()}}(),function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=6)}([function(t,n,e){"use strict";var r=Object.prototype.toString;if(e(3)()){var o=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==r.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&i.test(o.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,n,e){"use strict";var r=String.prototype.valueOf,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(i?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object String]"===o.call(t))}},function(t,n,e){"use strict";var r=Date.prototype.getDay,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"object"==typeof t&&null!==t&&(i?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object Date]"===o.call(t))}},function(t,n,e){"use strict";(function(n){var r=n.Symbol,o=e(5);t.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&o())))}}).call(this,e(4))},function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},n=Symbol("test"),e=Object(n);if("string"==typeof n)return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;for(n in t[n]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==n)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,n);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(t,n,e){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}e.r(n);var o=function(t){return"object"===r(t)?null===t:"function"!=typeof t},i=e(1),u=e.n(i),c={}.constructor("a"),s="a"===c[0]&&0 in c,f=function(){}.bind,a="function"==typeof f&&function(){var t=null,n=null,e=null,r=[];try{var o=f.apply(function(r,o){return e=this,t=r,n=o,arguments},[r,1]),i=o(2);return 1===o.length&&2===i.length&&1===t&&2===n&&e===r}catch(t){return!1}}()&&function(){var t=null,n=null,e=null,r=[1,2,3],o=function(o,i){return t=o,n=i,e=this,r};try{var i=f.apply(o,[null]),u=new i(1,2);return i.length===o.length&&u===r&&1===t&&2===n&&e!==r}catch(t){return!1}}(),l="".split,p=Math.max,y=o.bind,d=o.call,b=a?y.call(d,l):function(t,n){return l.call(t,n)},g=function(t){return u()(t)?b(t,""):t},v=function(t,n){var e=arguments.length>2?arguments[2]:[];if("string"!=typeof t&&o(t))return e;for(var r=s?t:g(t),i=r.length,u=p(0,n)||0;u<i;u+=1)e[e.length]=t[u];return e};function h(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return e}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var m=v.bind,w=v.call,S={},j=S.constructor,O=S.toString,T=function(t,n){return t>=n?t:n},x=function(t){if("function"!=typeof t&&"[object Function]"!==O.apply(t))throw new TypeError("bind called on incompatible "+t)},$=[function(t){return function(){return t.apply(this,v(arguments))}},function(t,n){return function(e){return t.apply(this,v(arguments,n,[e]))}},function(t,n){return function(e,r){return t.apply(this,v(arguments,n,[e,r]))}},function(t,n){return function(e,r,o){return t.apply(this,v(arguments,n,[e,r,o]))}},function(t,n){return function(e,r,o,i){return t.apply(this,v(arguments,n,[e,r,o,i]))}},function(t,n){return function(e,r,o,i,u){return t.apply(this,v(arguments,n,[e,r,o,i,u]))}},function(t,n){return function(e,r,o,i,u,c){return t.apply(this,v(arguments,n,[e,r,o,i,u,c]))}},function(t,n){return function(e,r,o,i,u,c,s){return t.apply(this,v(arguments,n,[e,r,o,i,u,c,s]))}},function(t,n){return function(e,r,o,i,u,c,s,f){return t.apply(this,v(arguments,n,[e,r,o,i,u,c,s,f]))}}],E=function(t){var n=h(t,3),e=n[0],r=n[1],o=n[2],i=T(0,r.length-T(0,o.length-2)),u=$[i],c=u?u(e,i):$[0](e);if(r.prototype){var s=function(){};s.prototype=r.prototype,c.prototype=new s,s.prototype=null}return c},P=function(t,n){var e=t.apply(this,n);return j(e)===e?e:this},F=a?w.bind(m):function(t,n){x(t);var e,r=arguments,o=function(){var o=v(arguments,0,v(r,2));return this instanceof e?P.apply(this,[t,o]):t.apply(n,o)};return e=E([o,t,r])},M=TypeError,N=F.apply,_=F(F.call,N),C=F(N,{}.toString),I=function(t){if("function"!=typeof t&&"[object Function]"!==C(t))throw new M(t+" is not a function");return t},k=function(t,n){return _(I(t),n,v(arguments[2]))},A=function(t){try{return{threw:!1,value:k(t,this,v(arguments,1))}}catch(t){return{threw:!0,value:t}}},D=e(0),X=e.n(D);for(var q=A(function(){return function(t,n){if(t!==n)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),"function"==typeof Symbol&&X()(Symbol(""))}.bind(void 0)),G=!1===q.threw&&!0===q.value,L=e(2),z=e.n(L),B=function(t){return!!t},H={}.toString,R=function(t){return function(t){if("function"!=typeof t&&"[object Function]"!==k(H,t))throw new TypeError("methodize called on incompatible "+t)}(t),function(){return k(t,arguments[0],v(arguments,1))}},U=R({}.toString),V=function(t){return null===t?"[object Null]":void 0===t?"[object Undefined]":U(t)},J=G&&X()(Symbol.toStringTag),K=function(t){return null==t},Q=function(t){if(K(t))throw new TypeError("Cannot call method on ".concat(t));return t},W="Cannot convert a Symbol value to a string".constructor,Y=function(t){if(X()(t))throw new TypeError("Cannot convert a Symbol value to a string");return W(t)},Z=function(t){return Y(Q(t))},tt=[{code:9,description:"Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\t"},{code:10,description:"Line Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\n"},{code:11,description:"Vertical Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\v"},{code:12,description:"Form Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\f"},{code:13,description:"Carriage Return",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\r"},{code:32,description:"Space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:160,description:"No-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:5760,description:"Ogham space mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:6158,description:"Mongolian vowel separator",es5:!0,es2015:!0,es2016:!0,es2017:!1,es2018:!1,string:"᠎"},{code:8192,description:"En quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8193,description:"Em quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8194,description:"En space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8195,description:"Em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8196,description:"Three-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8197,description:"Four-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8198,description:"Six-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8199,description:"Figure space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8200,description:"Punctuation space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8201,description:"Thin space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8202,description:"Hair space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8232,description:"Line separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2028"},{code:8233,description:"Paragraph separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2029"},{code:8239,description:"Narrow no-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8287,description:"Medium mathematical space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:12288,description:"Ideographic space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:65279,description:"Byte Order Mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\ufeff"}],nt="",et=tt.length,rt=0;rt<et;rt+=1)tt[rt].es2016&&tt[rt].string,tt[rt].es2018&&(nt+=tt[rt].string);var ot=nt,it=new(0,/none/.constructor)("^[".concat(ot,"]+")),ut=R("".replace),ct=function(t){return ut(Z(t),it,"")},st=new(0,/none/.constructor)("[".concat(ot,"]+$")),ft=R("".replace),at=function(t){return ft(Z(t),st,"")},lt=function(t){return ct(at(t))},pt=new(0,/none/.constructor)("[".concat(ot,"]+"),"g"),yt=R(" ".replace),dt=function(t){return yt(lt(t),pt," ")},bt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,gt=R("".replace),vt=function(t,n){return gt(Z(t),bt,arguments.length>1?Y(n):"")},ht=A.constructor,mt=R(A.toString),wt=/^class /,St=R(wt.test),jt=!1===A(function(){return ht('"use strict"; return class My {};')()}).threw,Ot=function(t){return St(wt,dt(vt(mt(t)," ")))},Tt=function(t){var n=A(Ot,t);return!1===n.threw&&n.value},xt=function(t,n){return!o(t)&&(J?function(t,n){return!(jt&&!1===n&&Tt(t)||!1!==A(function(){return mt(t)}).threw)}(t,B(n)):(!jt||!1!==B(n)||!Tt(t))&&function(t){var n=V(t);return"[object Function]"===n||"[object GeneratorFunction]"===n||"[object AsyncFunction]"===n}(t))},$t="string".constructor,Et=(0).constructor,Pt=G&&Symbol.toPrimitive,Ft=G&&Symbol.prototype.valueOf,Mt=["toString","valueOf"],Nt=["valueOf","toString"],_t=function(t,n){Q(t),function(t){if("string"!=typeof t||"number"!==t&&"string"!==t)throw new TypeError('hint must be "string" or "number"')}(n);for(var e="string"===n?Mt:Nt,r=0;r<2;r+=1){var i=t[e[r]];if(xt(i)){var u=k(i,t);if(o(u))return u}}throw new TypeError("No default value")},Ct=function(t,n){if(n){if(t===$t)return"string";if(t===Et)return"number"}return"default"},It=function(t){if(G){if(Pt)return function(t,n){var e=t[n];if(!1===K(e)){if(!1===xt(e))throw new TypeError("".concat(e," returned for property ").concat(n," of object ").concat(t," is not a function"));return e}}(t,Pt);if(X()(t))return Ft}},kt=function(t){var n=t.exoticToPrim,e=t.input,r=t.hint,i=k(n,e,[r]);if(o(i))return i;throw new TypeError("unable to convert exotic object to primitive")},At=function(t,n){var e="default"===n&&(z()(t)||X()(t))?"string":n;return _t(t,"default"===e?"number":e)},Dt=function(t,n){if(o(t))return t;var e=Ct(n,arguments.length>1),r=It(t);return void 0===r?At(t,e):kt({exoticToPrim:r,input:t,hint:e})},Xt=parseInt,qt=(0).constructor,Gt=R("᠎".charAt),Lt=/^[-+]?0[xX]/,zt=R(Lt.test),Bt=function(t,n){var e=ct(Y(t));return"᠎"===Gt(e,0)?NaN:Xt(e,qt(n)||(zt(Lt,e)?16:10))},Ht=2..constructor,Rt=R("Cannot convert a Symbol value to a number".slice),Ut=/^0b[01]+$/i,Vt=Ut.constructor,Jt=R(Ut.test),Kt=/^0o[0-7]+$/i,Qt=new Vt("[…᠎​￾]","g"),Wt=/^[-+]0x[0-9a-f]+$/i,Yt=function(t,n){return Bt(Rt(t,2),n)},Zt=function(t,n){return function(t){return Jt(Ut,t)}(n)?t(Yt(n,2)):function(t){return Jt(Kt,t)}(n)?t(Yt(n,8)):null},tn=function(t,n){var e=Zt(t,n);if(null!==e)return e;if(function(t){return Jt(Qt,t)}(n)||function(t){return Jt(Wt,t)}(n))return NaN;var r=lt(n);return r!==n?t(r):null},nn=function t(n){var e=function(t){if(X()(t))throw new TypeError("Cannot convert a Symbol value to a number");return t}(Dt(n,Ht));if("string"==typeof e){var r=tn(t,e);if(null!==r)return r}return Ht(e)},en=function(t){return t!=t},rn=function(t){return"number"==typeof t&&!1===en(t)&&t!==1/0&&t!==-1/0},on=function(t){var n=nn(t);return 0===n||en(n)?n:n>0?1:-1},un=Math.abs,cn=Math.floor,sn=function(t){var n=nn(t);return en(n)?0:0===n||!1===rn(n)?n:on(n)*cn(un(n))},fn=function(t){var n=sn(t);return n<=0?0:n>9007199254740991?9007199254740991:n},an={}.constructor,ln=function(t){return an(Q(t))},pn=G&&Symbol.prototype.toString,yn="function"==typeof pn&&X.a,dn="".constructor,bn=function(t){return yn&&yn(t)?pn.call(t):dn(t)},gn=function(t,n){if(!1===xt(t)){var e=arguments.length>1?bn(n):"".concat(o(t)?bn(t):"#<Object>"," is not a function");throw new TypeError(e)}return t},vn=R("".split),hn=function(t){return t},mn=s?hn:function(t){return u()(t)?vn(t,""):hn(t)};function wn(t,n){if(t!==n)throw new TypeError("Cannot instantiate an arrow function")}var Sn,jn="function"==typeof Array.prototype.findIndex&&Array.prototype.findIndex;if(jn){var On=[];On.length=2,On[1]=1;var Tn=A.call(On,jn,function(t,n){return wn(this,void 0),0===n}.bind(void 0));(Sn=!1===Tn.threw&&0===Tn.value)&&(Sn=!1===(Tn=A.call(1,jn,function(t,n){return wn(this,void 0),0===n}.bind(void 0))).threw&&-1===Tn.value),Sn&&(Sn=A.call([],jn).threw),Sn&&(Sn=!1===(Tn=A.call("abc",jn,function(t){return wn(this,void 0),"c"===t}.bind(void 0))).threw&&2===Tn.value),Sn&&(Sn=!1===(Tn=A.call(function(){return arguments}("a","b","c"),jn,function(t){return wn(this,void 0),"c"===t}.bind(void 0))).threw&&2===Tn.value)}var xn=Sn?function(t,n){var e=[n];return arguments.length>2&&(e[1]=arguments[2]),jn.apply(t,e)}:function(t,n){var e=ln(t);gn(n);var r,o=mn(e),i=fn(o.length);if(i<1)return-1;arguments.length>2&&(r=arguments[2]);for(var u=0;u<i;){if(n.call(r,o[u],u,e))return u;u+=1}return-1};n.default=xn}])}); //# sourceMappingURL=find-index-x.min.js.map