1.0.0 • Published 1 year ago

@lambrioanpm/at-nam-eos v1.0.0

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

@lambrioanpm/at-nam-eos Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2015 mostly-spec-compliant Reflect.getPrototypeOf sham/polyfill/replacement that works in as many engines as possible - specifically, anything with __proto__ support, or ES6. Built-in types will also work correctly in older engines.

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

Example

var getPrototypeOf = require('@lambrioanpm/at-nam-eos');
var assert = require('assert');

assert.throws(() => getPrototypeOf(true));
assert.throws(() => getPrototypeOf(42));
assert.throws(() => getPrototypeOf(''));
assert.equal(getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(getPrototypeOf(new Date()), Date.prototype);
assert.equal(getPrototypeOf(function () {}), Function.prototype);
assert.equal(getPrototypeOf([]), Array.prototype);
assert.equal(getPrototypeOf({}), Object.prototype);
var getPrototypeOf = require('@lambrioanpm/at-nam-eos');
var assert = require('assert');
/* when Reflect or Reflect.getPrototypeOf is not present */
if (typeof Reflect === 'object') { delete Reflect.getPrototypeOf; }
delete globalThis.Reflect;
var shimmed = getPrototypeOf.shim();
assert.equal(shimmed, getPrototypeOf.getPolyfill());

assert.throws(() => Reflect.getPrototypeOf(true));
assert.throws(() => Reflect.getPrototypeOf(42));
assert.throws(() => Reflect.getPrototypeOf(''));
assert.equal(Reflect.getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(Reflect.getPrototypeOf(new Date()), Date.prototype);
assert.equal(Reflect.getPrototypeOf(function () {}), Function.prototype);
assert.equal(Reflect.getPrototypeOf([]), Array.prototype);
assert.equal(Reflect.getPrototypeOf({}), Object.prototype);
var getPrototypeOf = require('@lambrioanpm/at-nam-eos');
var assert = require('assert');
/* when Reflect.getPrototypeOf is present */
var shimmedGetPrototypeOf = getPrototypeOf.shim();
assert.equal(shimmedGetPrototypeOf, Reflect.getPrototypeOf);
assert.equal(Reflect.getPrototypeOf([]), Array.prototype);

Tests

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

offsetvalidationstreams2routingshiminsortedgetoptdirectorytypesqsES7fast-copycoerciblecryptlocationcoreinspectgroupserializationdeep-copyArray.prototype.flattenArrayBuffercorscode pointsrm -frchannelvalueECMAScript 2020eslintpluginbundlinglessclies6predictableArray.prototype.flatMapUint8ArrayhookformObjectshebangoutputcomputed-typescjkespreeflatMapmatchAllES5lesscssbyteOffsetmomentyamlupconfigastaccessibilityprefixless.jsjestprototypesqsviewhashRxpropmapreducenested cssratelimit256collection.es6elbObject.getPrototypeOfspinnersnodejsSymbol.toStringTagdeepcolorsstyled-componentsconnectstateincludesreact-hooksflates-abstractnodeless csspostcssfigletString.prototype.trimWebSocketkarmatypescriptformattingmergequeueeslintconfigvariablesinstallsafeWeakMapseswaffastcopykeysspecES2017jasminermdircloudwatchparseextragroupByStyleSheetdataviewpathjapaneseiteratorrgbshamArraycommandworkflowBigUint64ArraycontainsxhrtestingiterateArray.prototype.includesidlereducechromepluginuninstallURLmixinsgetPrototypeOfES8touchschemastylefullJSON-SchemaES2019configurablebrowserliststreamsTypeBoxES2020cryptoRegExp#flagsbddpropertiesreduxhttpformsvisualcommandermovehasOwnPropertyInt32ArrayinputargstoSortedperformantMaptypetoolkitfastcloneentrieseveryes2016variables in cssPushlistenersspinnerenvreducerclassnamewritableWeakSetclassesworkerbusyRFC-6455definePropertyawaitfpstoolsweakmapdefinejoibreaktoArrayspeedfasttoobjectisConcatSpreadableES2022querydependency managerenvironmentwordbreakcolorfull-widthpushec2ES2018Uint32ArrayObject.isavajshasOwn0file systemframework$.extendmkdirstypeerrorguidduplexbyteLengthebsmetadatalastUint16Arrayes2015class-validatorES2021byteprogressstringifierlinewrapsettingsECMAScript 2016serializerECMAScript 3less compilerhardlinkssomewebfunctionalmrutextautoscalingpromisesequalstreames7invarianttrimRightprotomimetypesgetterECMAScript 2022autoprefixergradients csswidthRegExp.prototype.flagses2017authfindupstoragegatewaysearcheventEmitterbeanstalkthrottlebatchbcryptratetelephonetrimStartfastifynegative zerofindLastshrinkwrapponyfillkoreanrandomfilterdescriptionStreamimportpicomatchconsumephoneFunction.prototype.nametypeofprotobufconcatMapbuffersdeepclonedatastructuremkdirpObservablecopyapiencryptionlinkcolumnsartReactiveExtensionsprettyfind-uplivejsxprunedebuggerargvpackage.jsonfsauthenticationfolderwatchereslintdotenvchaistablethroatRxJScloudtrailfunctionsdropFloat64Arrayindicatorwrapjsdompromiseeslint-pluginparservalidescapedatereadablejavascriptenumerableObject.keyses-shim APIECMAScript 5ECMAScript 2023emrES3packageswordwrapparentstslibreact-hook-formInt8Arrayparentio-tsBigInt64Array@@toStringTagflagsfindcolourloadingsimpledbcodesawesomesauceES2023emojisharedarraybufferloggingcollectionrequestpackagelanguages3looktaskObject.valuesobjecttddes-shimsgradients css3jQuerysymlinkconcatdependenciessyntaxerrorajvzodmobiledeep-clonepackage managerstdlibwhatwgform-validationfseventspreserve-symlinksflattensymlinkscensorforEachbufferbrowserrdssuperstructsortelasticachereadablestreamfluxECMAScript 7importexportECMAScript 2015owncomparesymbolsrobusttesteroptimizertyped arraystartermiddlewarefetchwatchsetterfast-deep-clonePromisetypaniontssetPrototypeOfcompile lessmake direstreeregular expressionsquoteglaciersetImmediateerrornegativematchesECMAScript 2018vpcassigndiffapolloresolvezeroFloat32Arraycore-jswgetreactSymbolregular expressionjsonecmascriptesxterm[[Prototype]]multi-packagebindcommand-lineefficientsequenceeast-asian-widthelectronhasassertpreprocessorcachelazya11yCSSStyleDeclarationwaitl10nJSON-0Object.assignreplayprivatecall-bindwritestylingfast-deep-copyexpressstatelessdescriptorSettc39expressionArray.prototype.flatECMAScript 2021.envstylesheetgetOwnPropertyDescriptorschemearktypehotregexputilityjsdifftermnativeclassnamespnpm9toStringTaglengthcall-boundasyncECMAScript 6watchingbootstrap csspersistentreact-testing-libraryObject.fromEntriesmodulegetintrinsicassertioneventDispatchertrimLeftwalkArrayBuffer#slicereusestructuredClonechinesefunctionemitstylesidonceairbnbHyBimimesnslook-upECMAScript 2017deepcopyfindLastIndexttyconcurrencyscheme-validationaccessorcloudfrontdescriptorsstyleguidecircularUint8ClampedArrayECMAScript 2019TypeScriptURLSearchParamsimmercolumnmatchlogieboundhigher-orderweaksetmodulestypesafeinstallerruntimeworkspace:*cloudformationeventsdirsymbolcallnumbersetprotocol-buffersregularinternallimitwarningArray.prototype.filterlintterminalswfmonorepolibphonenumberredactdynamodbargumentomitless mixinsgenericsInt16ArrayArrayBuffer.prototype.slicebootstrap lessArray.prototype.findLastIndexarraynamesopenpositivedebugextensionamazonstringifyUnderscoremime-dbtypedarraysclonees8propertyObservablesAsyncIteratorhelpersarraybufferhttpsdataViewlruinferencevaluesES6checkStreamstypedarrayes2018npmdataES2016watchFileisclientwalkingcloudsearchutilitiescompilermapdom-testing-librarypipehooksroute53tostringtagequalityfast-clonebannerasciilimitedfixed-widthintrinsicCSSquerystringcharacteriamTypedArrayargparsepatchcallboundnopecallbindpyyamlESnextcss lessformMicrosoftsameValueZerointernal slotmakebundlerdeleterequireenderkeyString.prototype.matchAlljsonpath_.extendmkdirredux-toolkitsliceobjflagEScharactersoptionawsdayjsslotIteratorObject.definePropertytapeloggerYAMLrapidshellextendtimeoptimistglobcss nestingutilcurlimmutablees5gdprchromiumrangeerrorbrowserslistcss variableregexgetgraphqlpasswordtraversetapvalidatekinesisprivate dataarraysserializeArray.prototype.findLastReactiveXES2015cssutil.inspecttrimrmnameredirectpostcss-pluginjwtlockfileiterationperformanceassertsfromelmexecunicodecss-in-jssharedrm -rf__proto__domObject.entriesfullwidthuuidWebSocketssidesyntaxurltrimEndcallbackdeterministicajaxrecursivei18nsuperagentremoveformatbluebirdmochayuppolyfillconsoleminimalloadbalancingansi
1.0.0

1 year ago