1.0.0 • Published 13 days ago

@landmineaknpm/aliquid-possimus-accusamus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

@landmineaknpm/aliquid-possimus-accusamus Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES7/ES2016 spec-compliant Array.prototype.includes shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.

Because Array.prototype.includes depends on a receiver (the this value), the main export takes the array to operate on as the first argument.

Engines that need this package include:

  • IE (all versions)
  • Safari < 9
  • Firefox < 43, and 99-101
  • Chrome < 47
  • Edge < 14
  • node < 6

Getting started

npm install --save @landmineaknpm/aliquid-possimus-accusamus

Usage

Basic usage: includes(array, value, fromIndex=0)

var includes = require('@landmineaknpm/aliquid-possimus-accusamus');
var assert = require('assert');
var arr = [ 'one', 'two' ];

includes(arr, 'one'); // true
includes(arr, 'three'); // false
includes(arr, 'one', 1); // false

Example

var arr = [
	1,
	'foo',
	NaN,
	-0
];

assert.equal(arr.indexOf(0) > -1, true);
assert.equal(arr.indexOf(-0) > -1, true);
assert.equal(includes(arr, 0), true);
assert.equal(includes(arr, -0), true);

assert.equal(arr.indexOf(NaN) > -1, false);
assert.equal(includes(arr, NaN), true);

assert.equal(includes(arr, 'foo', 0), true);
assert.equal(includes(arr, 'foo', 1), true);
assert.equal(includes(arr, 'foo', 2), false);
/* when Array#includes is not present */
delete Array.prototype.includes;
var shimmedIncludes = includes.shim();

assert.equal(shimmedIncludes, includes.getPolyfill());
assert.equal(arr.includes('foo', 1), includes(arr, 'foo', 1));
/* when Array#includes is present */
var shimmedIncludes = includes.shim();

assert.equal(shimmedIncludes, Array.prototype.includes);
assert.equal(arr.includes(1, 'foo'), includes(arr, 1, 'foo'));

Tests

Simply clone the repo, npm install, and run npm test

bootstrap csscryptfast-cloneenvlinkfolderinternalcompile lesspostcssttypackage.jsonstringmonorepocolorjsdiffapollofunctionlettypeofsortedbuffersconcatlogstreamses7datastructureObject.keysstatelesspatchdependency managerclassnamefixed-widthfromcss$.extendajvArray.prototype.flattenflattensymbolssanitizekarmagetintrinsictapreal-timecoerciblemrufigletregular expressionsapigetPrototypeOfupjestWebSocketsnopetrimLeftgesturesexitpostcss-pluginpicomatchopenisConcatSpreadablecss nestingcorerandomregular expressionuser-streamsString.prototype.matchAlltsFunction.prototype.namesortplugintranspilerframergetpnpm9ECMAScript 2021mapextendfullwidthreact-testing-libraryStyleSheetclassnamescolumnbytetranspiletypedarraysprotobuflook-upinstallresolvevareveryparenttypescriptchanneli18nthreeECMAScript 2019matchAllqueryoutputmovegetterwalkingYAML.envpositiveprocesswatchingcjkjsdomtoolkitgradients cssvaluebabel-core[[Prototype]]emojifetchdom-testing-libraryjson-schemadrag@@toStringTagsafeArrayBuffer.prototype.slicedeterministicCSSStyleDeclarationjoipolyfilltostringtagbluebirdwatchFileObject.assigneslintconfigruntimefastcloneperformancedeep-copypathclonetypesxdg-openTypeBoxfile systemtraversemomenttakecss variablelimitECMAScript 2020awesomesaucePromiseES2016equalitypoint-freees2015call-bindexecrequestdependenciesdiroptionerror-handlingunicodedeletejQueryprogressdescriptorreadablecensornegative zerosetImmediatekeysredux-toolkitio-tsclientfunctionalfantasy-landArrayBuffer#slicewindowsyupCSSpopmotionTypeScriptdefaultscheme-validationansipackagestermArray.prototype.findLastformless.jscompilerextracheckhookformuuidcollectionstructuredClonestylesheetECMAScript 7connectBigInt64ArraynodejsArray.prototype.contains__proto__ES5computed-typesFloat64ArraywhatwgdataviewstableassignjsmixinsvalidwordbreaklesseditorfindLasturlfast-copyStreamwaapivestcopyclasseses2018estreeWebSocketdropqschailoadingES6bundlingArray.prototype.flatMaperrordeepTypedArrayquerystringObject.getPrototypeOfshamelectronwebsiteautoprefixerECMAScript 2022flatjson-schema-validationserializercurriedoptimizerkeyhttpjsonjasmineincludesstdlibaccessorsetPrototypeOfutilsprettysymlinksReflect.getPrototypeOfassertscharacterslaunchiterationnodetesterlinuxspinnersdeep-cloneintrinsicdirectoryforEachprotopackage managervariables in cssargumentssuperagentwatchervalidatorbrowserstatusreusebindtelephonefindtextsignalECMAScript 2015callbindlistenerswrapObservablesECMAScript 6configStreamsenvironmentbusyreact-hooksWeakSetlesscsscircularUint8ArrayserializemkdirpdatabdddefinePropertydatestylingreact-hook-formstylessharediteratoryamlrecursivehigher-ordershrinkwraparraysratelimitiearktypecmdfindupnamesopenerSetmakeutil.inspectcore-jsRxJSchildzodhasOwnfastifyReactiveExtensionsJSON-Schemamime-dblazypreserve-symlinksfiletrimStartposebatchMicrosoftasyncES7UnderscoreES2020prefixirqeslintplugineast-asian-widthpromiseindicatoreslastminimalbabel0eslint-pluginpipehelperstoobjectprotocol-buffersstartercss lessenumerableECMAScript 3argsbrowserlistMapUint16Arrayxssschemaobjexecutablestartcommand-linereducepreprocessorES8containsURLSearchParamsregexnested cssdifftestES2023less compilergetOwnPropertyDescriptorstreams2operating-systemhandlersES2021domfull-widthtacitvalidatextermwgetsuperstructlookstringifyESconsumearttc39macostapemergegenericssequencepyyamlstyled-componentsES2015trimRightcodeshardlinksreadtoolsURLconcatMapstreambcryptes-shimswalkjwtmulti-packagedeepcloneexpresslimitedcligroupBywatchcallboundinferencepropertiesframeworktypedefinemodulevalidationthrottleoffsetreducerviewspawnpropertyphonetypedequaljavascriptArray.prototype.filterformsRegExp.prototype.flagsserializationglobbundlerweaksetinstalleres-abstractavaJSONmkdirsassertes-shim APIchromeflatMapchinesesharedarraybufferes5springbannerauthenticationdataViewES2019Int8ArrayentriesflagBigUint64Arraypropargvbootstrap lesssidereduxECMAScript 2023buffermatchesfindLastIndexwidthRxESnextemitauthlinewrapterminalimmutablehasfunctionsgdprutilityfilteridleworkerhttpssameValueZeroanimationdebugconcurrencyimportcolumnsjsonpathsigtermSymbol.toStringTagspeedsigintfpECMAScript 2018eventEmittercommanderqueueMicrotaskvaluesshimawaitpasswordescapeassertionArray3durlsSymboltypesafenpmbreaksymbolissyntaxerrorObject.entriescorsgradients css3mochanumbertoSortedcss-in-jscolorsInt16ArrayAsyncIteratortddparentseventsefficientshellmatchworkspace:*languagetslibcode pointsprivatebyteLengthcreatecallbackinternal slotshebangtypanionfsquotefseventsArray.prototype.includesES2017robustsyntaxairbnbPush
1.0.0

13 days ago