1.0.0 • Published 1 year ago

@devtea2025/fuga-et-ratione-qui v1.0.0

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

@devtea2025/fuga-et-ratione-qui Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES5 mostly-spec-compliant Object.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('@devtea2025/fuga-et-ratione-qui');
var assert = require('assert');

assert.equal(getPrototypeOf(true), Boolean.prototype);
assert.equal(getPrototypeOf(42), Number.prototype);
assert.equal(getPrototypeOf(''), String.prototype);
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('@devtea2025/fuga-et-ratione-qui');
var assert = require('assert');
/* when Object.getPrototypeOf is not present */
delete Object.getPrototypeOf;
var shimmed = getPrototypeOf.shim();
assert.equal(shimmed, getPrototypeOf.getPolyfill());

assert.equal(Object.getPrototypeOf(true), Boolean.prototype);
assert.equal(Object.getPrototypeOf(42), Number.prototype);
assert.equal(Object.getPrototypeOf(''), String.prototype);
assert.equal(Object.getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(Object.getPrototypeOf(new Date()), Date.prototype);
assert.equal(Object.getPrototypeOf(function () {}), Function.prototype);
assert.equal(Object.getPrototypeOf([]), Array.prototype);
assert.equal(Object.getPrototypeOf({}), Object.prototype);
var getPrototypeOf = require('@devtea2025/fuga-et-ratione-qui');
var assert = require('assert');
/* when Object.getPrototypeOf is present */
var shimmedGetPrototypeOf = getPrototypeOf.shim();
assert.equal(shimmedGetPrototypeOf, Object.getPrototypeOf);
assert.equal(Object.getPrototypeOf([]), Array.prototype);

Tests

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

getOwnPropertyDescriptorformattingperformanttesterisConcatSpreadablegetoptartlruECMAScript 2018less compilerdiffdependenciestoStringTagmomentpostcssString.prototype.trimopenskoreanjwtglobUnderscoreexpressajaxargumentwidthidhasOwnPropertytakeansidebugreducestoragegatewayObject.entriestoobjectFunction.prototype.nameajvxdgserializationeslint-pluginrangeerrorstdlibnegativedescriptorspathbundlinginstallermobileES8command-lineownsuperstructlimitbreak[[Prototype]]eslintweaksetutil.inspectregexpbluebirddefaultautoscalingsesjoi$.extendjsprototypejsonpathsharedarraybufferES2018awsisagenthandlersstablecallzeroreduxbrowsertypescriptecmascriptes-shimsratecallboundsettingsmkdirfile systemObject.assignstylinggenericsMicrosoftECMAScript 6enumerableECMAScript 2021linewrapeditorfsbytezodprotocol-bufferscloneentriesasyncxdg-openwatchkeysmapreduceEScolourinprivatedeterministicmixinslibphonenumberjsxtypanionfindTypeBoxlengthworkflowimportexportspecpackage.jsonWebSocketsregexsomefullwidthassertses-abstractnpmclassesECMAScript 2023rmdirrgbconnectbuffermakebeanstalkstatusfetchpropertiesimportgloballooktelephoneArraytypewalkingwindowselasticachethrottlees2018jshintfromsiginteast-asian-widthES7movecharactersexpressionwritablereducerstylestrimwritenamesshebangqspipepositivecolorsvpcimmutablepicomatches2016appeventEmitterregularfast-deep-copyl10nReactiveXObject.getPrototypeOfassignpolyfillloadingvaluesmruWeakMapRxform-validationreact-testing-library__proto__functionexecbcryptbusyloggingrandomflatrobustslicearktypejavascripthotrestfulFloat64Arraystring-0interruptsArray.prototype.flattenECMAScript 2020sequencecontainsRFC-6455identifiersfunctionalwatchersortes5trimStartSetECMAScript 2016less mixinssyntaxdynamodbfluxcloudwatchxhrdeleteerror-handlingspinnerseventDispatcherreact-hookscoercibleperformanceArray.prototype.includeshttpReactiveExtensionsECMAScript 3spinnercss nestingcollection.es6mergeparserpyyamlprogresscolumnroute53prunewordwrapthroatphonees2017middlewarestructuredCloneiteratedataviewtrimLeftlessviewinputES3Int8ArrayextraformsslotpluginPromisecolumnsfast-clonefastopenjQueryutilitiesUint32ArrayObject.keysencryptioneverybannerbundlerelbrm -frspawntypedarrayskeycomputed-typesgradients css3logefficientfpsfast-deep-clonestringifyscheme-validationfixed-widthcode pointsformatstreams2concatfindupbrowserlistsyntaxerrorlistenersreadmatchAllES2021utilitytypescjkfolderArray.prototype.containsSymbolcollectionconcatMapoptimistdayjsstylesheethttpsflattenqueueMicrotaskgradients cssES2015MapArrayBuffer.prototype.sliceECMAScript 2015byteLengthtypeerrortrimEndchineseloggerCSSStyleDeclarationnameconfigWebSocketpackageobjes6monorepoYAMLnativeunicodecompile lesswafexit-codefind-uppatchsetweakmapglobalsgetPrototypeOfregular expressionsemitresolvetoolsRegExp#flagsdataprocessprefixjsdiffdescriptionidlepromisespushworkerirqomitvalidationec2cryptprettyclassnamesBigInt64ArraysetterschemetestingwatchFilebrowserslistaccessibilityincludesvariables in cssStreamgetterarraysCSStrimRightwebless.jscallbackredux-toolkitclass-validatorshamflagseslintplugincircularlesscssECMAScript 2017look-upttyduplexRegExp.prototype.flagsdescriptortypeofTypedArraydefinePropertyhardlinkscmdprop.envtypedarraycopypropertyfastifypnpm9String.prototype.matchAllshimsuperagentpackagesFloat32Arraytostringtagreusecore-jsfulleventsrestintrinsiccssformassertinternalchromeoffsetescapecurlclassnamecachestateauthshrinkwrapES2017promisecommandererrortestconcurrencysigtermObservablescensoremrnodeObject.fromEntriesparentsIteratortoSortedstyleguidesqstswordbreakuuidautoprefixerrapidjasmineiterationgroupprotorequirereadablestreamiamcss variableflatMapwatchingamazonboundenvchannelconsumelaunchargparsegroupByastsymlinkreplaycss-in-jsasciicall-bindelmsymbolremovecloudformationauthenticationqueryfilteremojirequestspeedECMAScript 2022routeravaArray.prototype.filterclicommandtddgetdataViewvestArray.prototype.findLastcss lesscloudsearchES2023negative zerojestvariablesdotenvparseyamlwebsiteurlstypesafelazyterminalmimeUint8ClampedArrayECMAScript 2019react-hook-formJSON-SchemarmcompilerArray.prototype.findLastIndextaperecursiveinternal slotArrayBuffertyped arraywhichsignalmimetypesdeepclonemkdirpworkspace:*cryptoconsoleapicodesReflect.getPrototypeOfvalidWeakSetinferencetermarraybufferfastcloneexenodejsschemaprivate dataparsingdropguidliveoptimizermacosES2019minimalchilddeepdatastructurecorsenvironmentscomparejsdom@@toStringTagyupimmerendertsliblinuxdefinematchesfileurlObject.definePropertyargvsafefindLastIndexfseventslimitedInt32ArrayforEachjapanesesymbolstaski18npostcss-pluginextendredactdom-testing-libraryawesomesaucedommkdirsparentUint16Arraysnsmime-dbendpointkarmaswfawaitshellinspectStyleSheetObject.valuesequalArray.prototype.flatMapstreames2015setPrototypeOflanguagetouchTypeScriptcloudtrailvaluedateHyBiRxJSESnextbdddependency managerquoterdsloadbalancingpreserve-symlinkscallbindreal-timetaps3multi-packagewalkES5textES2022Observabledirrm -rfsetImmediatelinkwrapqueueextensiones-shim APIenvironmentbuffersargsebslintesinvarianthasupInt16Arrayhas-ownexecutablejsonnumberiesinatraonce0last256waittoolkitoutputhashtypedECMAScript 7mochatimeoptionlockfiledeep-clonewgetfunctions
1.0.0

1 year ago