1.0.0 • Published 12 days ago

@drftgyhuji7npm/iure-ad-cum v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

@drftgyhuji7npm/iure-ad-cum Version Badge

github actions coverage License Downloads

npm badge

Define an accessor property on an object. In an engine without descriptors, in loose mode, when only a getter is provided, nonEnumerable is false, and nonConfigurable is false, wil fall back to assignment - otherwise, it will throw.

The two non* options can also be passed null, which will use the existing state if available.

The loose option will mean that if you attempt to set a nonconfigurable/nonwritable accessor property with set, in an environment without descriptor support, it will fall back to normal assignment (and eagerly evaluate the getter).

Usage

var defineAccessorProperty = require('@drftgyhuji7npm/iure-ad-cum');
var assert = require('assert');

var str = 'value';
var strThunk = function () { return str; };
var strSetter = function (v) { str = v; };
var random = function () { return Math.random(); };

var obj = {};
defineAccessorProperty(
	obj,
	'key',
	{
		get: strThunk,
		set: strSetter,
	}
);
defineAccessorProperty(
	obj,
	'key2',
	{
		get: random, // at least one of "get" or "set" must be provided
		nonConfigurable: true, // optional
		nonEnumerable: true, // optional
		loose: false, // optional
	}
);

assert.deepEqual(
	Object.getOwnPropertyDescriptors(obj),
	{
		key: {
			configurable: true,
			enumerable: true,
			get: strThunk,
			set: strSetter,
		},
		key2: {
			configurable: false,
			enumerable: false,
			get: random,
			set: undefined,
		},
	}
);
getPrototypeOf6to5mime-dbartpolyfillrandomstablepreserve-symlinksform-validationfast-copydataViewlastxdg-openenderopensStreamsobjformpostcss-pluginqschailazyguidvaluesdefaultjson-schema-validatorassertsdayjsastmkdirsymbolsyupdragargvmakeObject.entrieschanneljasminebcryptregexpES2020utilitiestrimStartECMAScript 2020[[Prototype]]hashmobileecmascriptstatelesscolorswriteredacteventDispatcherconcatMapdropInt16Arraylookcore-jsinstallervariablescompile lessnegative zeroES2022shrinkwrapwordwrapgroupByisextendBigUint64ArrayurlsmruReactiveXgesturesEScall-boundreact-testing-libraryexittoolkitshampathtranspileexpressionthrottlecryptobyteidlequeueMicrotaskbabelsetImmediatecloneprefixObject.iskoreanesinspectstyleguidefsponyfillarraybufferbddstringmimefunctionansiawesomesauceTypeBoxnamemapjsonpathxhrrm -rfWebSocketirqrequiremake dires2017copyapiless cssi18nvarformatESnextjsdompostcsspromisescoerciblenested cssenvfast-cloneassertionfilebufferparserloggerextraes2018iteratesymbolcommandpositiveobjectpopmotionstringifyPushgetprotolintstreams2sliceassignkarmagroupkeysmimetypesqueueargumenttypesafeviewrgbes8httpcolorhttpsloadingtypescriptmulti-packagefantasy-landeventsArray.prototype.flatteniteratorzoderror-handlingkeyjQueryjsbatchintrinsicArray.prototype.includestestcompareshebangvisualInt32ArrayfastcloneclassnameJSONwaitconcurrencycode pointsECMAScript 6ES2017tapxdgfastcopyWebSocketsserializermovedatelinewrapdirectoryoffsetshellbundlerbuffersgetintrinsicArray.prototype.findLasttasklimitedtoStringTagequaltypeofMapasyncObject.getPrototypeOfECMAScript 2018Uint16ArrayjwttraversettyapollourlsetPrototypeOfFloat64ArrayautoprefixerslotES2019Observableschemapackagessyntaxerrorbabel-corepreprocessorexpressawaitinputSymbol.toStringTagdebuggerenvironmentuuidreadwebsiteharmonypyyamllinkprunewalkbrowserlistECMAScript 2019invariantvalueuser-streamsconfigurablelook-updeepcloneRxJSnopeflattentrimEndhascallbounddataviewpasswordreact animationargparse_.extendprotobuftakewidthloginternalFloat32ArrayarraycolumnES8parsenamestelephoneprocessopenvesthandlersdebugbluebirdeslintpluginexectstoArraysigtermObject.keysmatchAll$.extendavadefineruntimestylesdeep-copymatchesframeworkstartes6Array.prototype.filtermiddlewaretddECMAScript 7fast-deep-copycallbindmetadatacensorchromeeditornegativegetteryamlmoduleregularqueryzeroutilityjoijsdiffletstringifierappjsxvariables in csspushfind-upgetOwnPropertyDescriptormkdirseslintconfigincludescss variableargspropertiesexecutableObservablestypedarraysArrayBufferauthfpexit-codeAsyncIteratorpropertyoptimizerremoveless compilersuperstructasserttypepackage.jsoncss nestingoperating-system256warninglinuxhooksMicrosoftreal-timewatcheranimationinternal slotefficienttslibauthenticationoptionexecommand-lineutilswaapiescapePromisefindupArray.prototype.findLastIndexsuperagentes-shim APIwritablebusyreadablestreamxssjapaneseconsoledeep-cloneformsglobquotearktypeinterruptsposedescriptiontextjsonschema
1.0.0

12 days ago