1.0.0 • Published 1 year ago

@f1stnpm3/tempora-cum-provident v1.0.0

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

@f1stnpm3/tempora-cum-provident 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('@f1stnpm3/tempora-cum-provident');
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('@f1stnpm3/tempora-cum-provident');
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('@f1stnpm3/tempora-cum-provident');
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

installerfindschemaES8utilES2018randomstdlibswfwatchingimportexportlook-uptc39ECMAScript 2021lastArray.prototype.flatisConcatSpreadabletapauthkarmaTypedArraycss lesswalkestreecryptoawsdefinePropertylookendpointObject.fromEntriesreusefull-widthpackage.jsonlanguagejsonpathextensionrecursivereadablestreamelmcloudformationfast-deep-clonewarningmomentESnextweakmapchaijsconsolestyled-componentscrypteventsBigInt64ArrayRegExp#flagsrmdirfullwidthfunctionsgetintrinsiccreatematchAllelectrondescriptionFunction.prototype.namecore-jscolorzodlesscssObject.keysefficientsyntaxerrorYAMLcorecss-in-jsindicatorkeyscors-0uproutingregexInt32Arraystylesroutesyntaxrmobjinspectvariablesjwtclassnamenegativeparserhelperses-shimsfileaccessibilitycallboundes6toStringTag@@toStringTagloadingtouchpicomatchvpcweaksetebspnpm9reduxObject.assignstylecallcollectionmodulewatchFileprop_.extendartbufferspipelinkprotoa11yArrayprefixECMAScript 2018javascriptinputspeedasyncieequaljasminedependency managerrestfuleslintconfigsetImmediateintrinsicbufferuuiditeratorboundSymbolpredictableslotsymbolObject.isarraybuffergetOwnPropertyDescriptorruntimespectraverseesStreamscall-bindFloat32ArrayES2021modulesxtermclassesObservableswalkingscheme-validationfolderfindupwordbreakimmerminimalBigUint64ArraycolourcodestrimRightes8typedarraypositiveomitURLSearchParamsrouterCSSStyleDeclarationvestbcrypttoolkitES2017loggingprunebootstrap lesscensorwhichcloudtrailSetrm -rfdeletesharedpatchapiclass-validatorprogressincludesECMAScript 2019hookssigintfullchromesorttypess3symlinkmkdirsrgbfastkeyhigher-orderES7phonequerytsObject.definePropertyInt8ArraytelephonenpmAsyncIteratorObject.getPrototypeOffastifybrowserprivate datadebuggerperformanceregexppackagepackagesaccessorcloudwatchjestinterruptsmkdirpines7elasticachestreamswatchPushmake dirjQueryreactbundlingmonorepochromiumECMAScript 5persistentcompile lessecmascriptec2tddes2015hascharacterwhatwgworkspace:*deepcloneRegExp.prototype.flagstypeofsnscoercibleroute53qswaitsequenceoutputtrimEndsortedopendiffdateformattingfast-cloneeveryreact-hookslogamazonwebframeworkdeep-copyansimixinstypescriptReactiveExtensionsreduceschemeplugintapeString.prototype.matchAllserializationmiddleware256fluxhotbindtypesafeconfigurableserializerstyleguidequeueshiminternal slotnativetask$.extendstreams2airbnbisgenericsflatMapdatastructuretrimStartsuperstructidnopeECMAScript 7requireredux-toolkitio-tserror-handlingbusyterminalkoreanexit-codepreserve-symlinksconcatdescriptorscomputed-typesvalidationqueueMicrotasktakegetcopyponyfillpreprocessorhardlinkszeroES2020hashstreamgradients css3Symbol.toStringTagnamejapaneseemojicall-boundless.jsgetPrototypeOftoobjectlintdroppackage manageriamurlequalityiteratehttptimedirectorygroupByES2023css nestingsomeemitcloudsearchObservablearraysECMAScript 6Array.prototype.includessharedarraybufferjsdiffeventDispatchertrimpyyamlinvariantArray.prototype.containsrapidextendsqstestflagsworkflowstateremovehas-owntypedshellenderfastcopysymbolstermfromdataiterationes-shim APIbyteLengtheslint-pluginargumentES2016callbackeslintplugincheckmatchespasswordescapetoolsless compilerfast-copyresolvesliceformsTypeScriptcommandStream[[Prototype]]structuredCloneimmutableES2015protocol-bufferslistenersutilitiesArray.prototype.findLastIndexoptionJSON-Schemadeterministicgetoptprettystatusfseventsoperating-systemparsingobjectJSONtostringtagconcurrencyenvironmentes5privateajvform-validationhasOwnawesomesauceflatdependenciesECMAScript 3debugspinnersmapreduceshamcommand-linecss variable.envchannelMapquerystringpath
1.0.0

1 year ago