1.0.0 • Published 1 year ago

@devtea2025/a-quae-a-necessitatibus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@devtea2025/a-quae-a-necessitatibus Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES5 spec-compliant Array.prototype.filter 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 spec.

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

Example

var filter = require('@devtea2025/a-quae-a-necessitatibus');
var assert = require('assert');

assert.deepEqual(filter([1, 2, 3], function (x) { return x >= 2; }), [2, 3]);
assert.deepEqual(filter([1, 2, 3], function (x) { return x <= 2; }), [1, 2]);
var filter = require('@devtea2025/a-quae-a-necessitatibus');
var assert = require('assert');
/* when Array#filter is not present */
delete Array.prototype.filter;
var shimmedFilter = filter.shim();
assert.equal(shimmedFilter, filter.getPolyfill());
var arr = [1, 2, 3];
var isOdd = function (x) { return x % 2 !== 0; };
assert.deepEqual(arr.filter(isOdd), filter(arr, isOdd));
var filter = require('@devtea2025/a-quae-a-necessitatibus');
var assert = require('assert');
/* when Array#filter is present */
var shimmedFilter = filter.shim();
assert.equal(shimmedFilter, Array.prototype.filter);
assert.deepEqual(arr.filter(isOdd), filter(arr, isOdd));

Tests

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

less compileroffsetgetOwnPropertyDescriptorredux-toolkittypedarrayES5bcryptchinesewatchFileajvchannelschemeweakmaperror-handlinghandlersECMAScript 2023lintdomiterationargs__proto__fastclonees6deletepropertycolumnsstatelessSetmixinsxdg-openstyleguideclifastcopycompilercallboundES2016configconnecthaslookloadingargumentsmochafunctionalcore-jsrm -fremrES8moduleskorean$.extendfastcharactersObjectawaitparentsSymbolparsecommand-linel10nsigtermassignString.prototype.matchAlltyped arrayECMAScript 7css-in-jsautoscalingairbnbdefaultString.prototype.trimeveryTypedArraypropbrowserrfc4122awscolorslotpackageRFC-6455preserve-symlinksTypeScriptgetFloat64Arrayquotees-shimsES2023ES7indicatorcachesetPrototypeOfasciitoolstelephoneredactmkdirinmimelogecmascriptarraybuffernatives3writablepersistentwebprotocol-buffersimmerMicrosoftUnderscoreECMAScript 2021arraykarmaURLcharacterrm -rfes5trimLeftArray.prototype.flatsetcallbindprototypeopenerPromiseglobalsvarstoolkitlaunchtrimObject.keyssimpledbpackagesxhremojia11yio-tscss lessserializechromeregularescapeendpointresolvetoSorteddataViewbusyperformantreplaybyteOffsetartpreprocessorpathspecthrottlees8linuxebsfetchlinewrapimmutablebootstrap cssformatfigletworkertslibtermfull-widthCSSbootstrap lessutilitiesIteratorconsoleopenclassnamesjsonvariables in cssrequiremiddlewareworkflowis256exit-codedeeproute53livemoverouterWebSocketurlsflagsdescriptorsmake dirconcurrencyURLSearchParamsmomentassertsdebugidletypedarraysstructuredClonenegativeavasharedstyled-componentsformattingwaitcorslimitedhttpsfunctionssinatraless csspyyamlstartplugintrimEndnested cssstreams2flagmruArray.prototype.findLastIndexreadablestreamimportform-validationopensshimflattenintrinsictouchjsonpathdatastructurerobustappvestforEachvariableseslint-pluginshelldatalistenerssymlinkECMAScript 2017mergewebsitezerohookshigher-orderreusefixed-widthsymbolsparsingponyfilljavascriptirqstringifypnpm9accessibilityES2018dotenvvaluecircularpromiseskeyinvariantserializerratefindLastIndexexpressionansihardlinksRegExp.prototype.flagslanguagetextperformancetypescriptArrayBuffer#slicedirArray.prototype.containsJSON-SchemaInt32ArraymetadataECMAScript 2019runtimevalidateES2017loggingjsdependenciescopyoptimistregexUint8ArraysignalJSONlesscssprivatedescriptionbreakStreamseast-asian-widthregexpwrapxdgdynamodbtypesafepostcsscall-boundmatchesnodeInt16Arraylook-upUint32ArrayproxyRxspawncloudfrontObservablesvalidentrieswhichjwtcjkes-abstractcallbackdefineconfigurablegroupBySymbol.toStringTages2016execenvpicomatchstylingarktypedebuggercolourflatsliceserializationminimalrestcheckoutputcode pointslastdatecoreshamES6BigUint64ArrayArraystdlibjshintfromcontainseslintbyteyuppositiveuninstalltostringtagbindbddaccessorjestprivate dataArray.prototype.includestrimRightArrayBuffertyperandomfast-copyobjectchaimimetypeskinesisUint16ArrayES3deep-copytypanionequalargumentupESnextsesauthenticationgetterswfless mixinsObject.valuesrecursivesettingsfind-upesmkdirpexpressviewgroupstatecloudformationfile systeminferencelazywgetmkdirscollectionnopeprunesuperagentfunctionpushsortfpsInt8ArraymatchAllhttpcalloperating-systemcss variablefast-deep-copymakeyamlprogressmobileargparsenumberphoneweaksetcommanderequalitytaskpredictableajaxconsumearrayscloudsearchquerystringsearchclassesnpmamazontddnamestraverseArray.prototype.findLastcolorsschemaYAMLendergenericsreadablewarningbuffersfileutil.inspectinspectsequencewordbreakapiawesomesaucebeanstalksameValueZeroes2017has-ownES2015matchsafesqsinputjsxlrutesteditortestingspinneriddeepclonerangeerrorqsECMAScript 2016browserslistestreelinkcss nestingiteratetapedayjsAsyncIteratorclassnameprotobufwalkelectronhelpersECMAScript 5hasOwnobjsomeObject.defineProperty
1.0.0

1 year ago