1.0.0 • Published 8 months ago

@wemnyelezxnpm/architecto-rem-tenetur v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@wemnyelezxnpm/architecto-rem-tenetur Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2017 spec-compliant shim for Object.getOwnPropertyDescriptors that works in ES5. Invoke its "shim" method to shim Object.getOwnPropertyDescriptors if it is unavailable, and if Object.getOwnPropertyDescriptor is available.

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

Example

var getDescriptors = require('@wemnyelezxnpm/architecto-rem-tenetur');
var assert = require('assert');
var obj = { normal: Infinity };
var enumDescriptor = {
	enumerable: false,
	writable: false,
	configurable: true,
	value: true
};
var writableDescriptor = {
	enumerable: true,
	writable: true,
	configurable: true,
	value: 42
};
var symbol = Symbol();
var symDescriptor = {
	enumerable: true,
	writable: true,
	configurable: false,
	value: [symbol]
};

Object.defineProperty(obj, 'enumerable', enumDescriptor);
Object.defineProperty(obj, 'writable', writableDescriptor);
Object.defineProperty(obj, 'symbol', symDescriptor);

var descriptors = getDescriptors(obj);

assert.deepEqual(descriptors, {
	normal: {
		enumerable: true,
		writable: true,
		configurable: true,
		value: Infinity
	},
	enumerable: enumDescriptor,
	writable: writableDescriptor,
	symbol: symDescriptor
});
var getDescriptors = require('@wemnyelezxnpm/architecto-rem-tenetur');
var assert = require('assert');
/* when Object.getOwnPropertyDescriptors is not present */
delete Object.getOwnPropertyDescriptors;
var shimmedDescriptors = getDescriptors.shim();
assert.equal(shimmedDescriptors, getDescriptors);
assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj));
var getDescriptors = require('@wemnyelezxnpm/architecto-rem-tenetur');
var assert = require('assert');
/* when Object.getOwnPropertyDescriptors is present */
var shimmedDescriptors = getDescriptors.shim();
assert.notEqual(shimmedDescriptors, getDescriptors);
assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj));

Tests

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

PromisetrimRightdatemkdirvalueschemefunctionsratebabelreact-hook-formgraphqlvalidatenativeconsumeeventDispatcherECMAScript 2023stablecoretoStringTagjsdiffstatusdatayamlsidescheme-validationfind-uppackageES2023reducerpropflatMapwritecirculartoArraybannerelectronl10nrangeerrortddsearchObject.definePropertyIteratortermnodees8fantasy-landlinuxbootstrap csslook-uptoSortedObject.entriesnodejsString.prototype.matchAllgesturesjsxES2015RxJSwgetdomfunctionalonceexpressionnegativeramdaterminalinstallclientsymlinkpromisesjsonpathEScolumnsmodulebabel-coreArrayBuffer#slicesyntaxbrowservalidjavascriptiteraterm -rfauthenticationasserts256react animationrgbmimechanneltranspilercontainssafeformArray.prototype.flatteninterruptsesES2017specpipeform-validationsymlinkstyped@@toStringTagJSON-Schemapluginsymbolsassignfast-copyObject.getPrototypeOfInt32ArrayBigUint64ArrayCSSdebugdeletetrimLefttapearraysxssdefinePropertybrowserlisttrimtoolkitqueueMicrotaskstdlibsetPrototypeOfentrieses7flaturlrecursiveArray.prototype.findLastIndextextsyntaxerrorcall-bindletweakmapkeysreadablestreamwaitjasmineastprivatebundlingreact-testing-librarymixinsES5WeakSetes-shim APIequalschemaJSONmakesanitizetrimStartdeepcopyArrayBuffer.prototype.sliceFloat32Arraybyteflagsevery[[Prototype]]calldiffmodulesECMAScript 2016mkdirshascss variablecurriedprogresscharactersgetcollectionoptimizerfullcurlfilejsonschemacensorRxcss-in-jsintrinsicECMAScript 2022touchmiddlewarecss lessquerystringWebSocketslimitserializeemojiUnderscoreES6real-timegenericsboundposeUint8ClampedArraynamereduxSymbolMapsignalsArray.prototype.flatMapthrottletimespinnershelpersviewirqshrinkwrapESnextbootstrap lessfunctionless compilerCSSStyleDeclarationsigintreduceECMAScript 2020react-hooksunicodesignalECMAScript 7bindObject.valuestraversematchAllbddsortedforEachcommand-linepreprocessorstyleguidefast-deep-copypackagestostringtagchromelinewrapparentsES8awaittyped arrayextraAsyncIteratorfullwidth$.extendgetintrinsicequalityfp.envlintdescriptorstylesheetcompilerTypeBoxloadingrandomMicrosoftclassnamepruneajvmochathreehandlersshimclisharedwhichmimetypesdeterministicextendprotocol-bufferscss nestingreuseWebSockettrimEndpostcssmapmacosconsolefastifytoolsquotegroupReflect.getPrototypeOfgetterES2018ObjecthookscallboundconcurrencyArray.prototype.findLastkeycjkwritablecopycryptoarktypevaluesbrowserslist
1.0.0

8 months ago