1.0.0 • Published 1 year ago

@crabas0npm/explicabo-illum-distinctio v1.0.0

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

@crabas0npm/explicabo-illum-distinctio Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Define multiple non-enumerable properties at once. Uses Object.defineProperty when available; falls back to standard assignment in older engines. Existing properties are not overridden. Accepts a map of property names to a predicate that, when true, force-overrides.

Example

var define = require('@crabas0npm/explicabo-illum-distinctio');
var assert = require('assert');

var obj = define({ a: 1, b: 2 }, {
	a: 10,
	b: 20,
	c: 30
});
assert(obj.a === 1);
assert(obj.b === 2);
assert(obj.c === 30);
if (define.supportsDescriptors) {
	assert.deepEqual(Object.keys(obj), ['a', 'b']);
	assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'c'), {
		configurable: true,
		enumerable: false,
		value: 30,
		writable: false
	});
}

Then, with predicates:

var define = require('@crabas0npm/explicabo-illum-distinctio');
var assert = require('assert');

var obj = define({ a: 1, b: 2, c: 3 }, {
	a: 10,
	b: 20,
	c: 30
}, {
	a: function () { return false; },
	b: function () { return true; }
});
assert(obj.a === 1);
assert(obj.b === 20);
assert(obj.c === 3);
if (define.supportsDescriptors) {
	assert.deepEqual(Object.keys(obj), ['a', 'c']);
	assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'b'), {
		configurable: true,
		enumerable: false,
		value: 20,
		writable: false
	});
}

Tests

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

immershamURLSearchParamsweaksetdirlook-upECMAScript 7a11yinputArrayBuffer.prototype.slicegroupBythreeoutputlimitedpackagesfindvalidECMAScript 2018directoryviewWeakSetpostcsscall-boundqspruneES5watchfindLastoptimistphonevaransimkdirsECMAScript 2020taskhelpersformattingstreamsettingsargv6to5listenerscolorsoffsetirq-0structuredCloneECMAScript 2023protoassignjQuerymixinsclassesencryptionasciiratelimitglobarraybuffercolumnscloneart256mimetypesmacoses5bluebirdTypeScriptlinkjson-schema-validationeventDispatchernested cssautoprefixerstatusrequestcss variableasyncECMAScript 2019RFC-6455regularpackageurlflagsthroatminimalgetterobjcomparekeysJSONcomputed-typeshttpajvRxbabelES2019typescriptgraphqlwritechannelisConcatSpreadablefindLastIndextrimEndtoobjecteventsfullwidthworkspace:*gettypeerrorlockfileES2015quote[[Prototype]]util.inspectframeworkmobileoncedependenciesIteratortypedarrayzeroperformantschemewarningtypesdeep-clone@@toStringTagwhichhttpshasOwnbannerrangeerrorlintcollection.es6argparseobjectiemiddlewarecryptsigtermRegExp#flagsendersidewordbreakresolveprefixcircularfetchReflect.getPrototypeOfcss nestingsearchfolderESnextreact-testing-librarygroupuser-streams3dgradients cssjsonschemaRegExp.prototype.flagsfastlimitArray.prototype.filterflatyupio-tsrequirevaluesmoduleses2016reduceeslint-pluginpopmotionaccessoreveryoptionbootstrap lessBigUint64ArraywaapibundlerES2020commandforEachtakekoreanreact poseidleUint32ArrayECMAScript 5busytsrmdirkarmainternal slotreadbounderror-handlingapipropertyBigInt64Arrayless.jsInt16ArrayjoiconfigurablegetoptutilitiesauthwatchFilewebsomecallbackecmascriptbuffersparentspackage managerinternalcssinstallerlooktrimwritableterminalwalkingiterationcollectionnodejsdeepclonelanguagetrimLeftinspectes2015intrinsicmodulecolorjsonestreeclassnameObject.entriescurlfixed-widthprogresses-shim APIwidthString.prototype.trimrm -frSymbolInt8Arrayreadablestreames2017URLWeakMapenvwrapbrowserlistpackage.jsongdprArray
1.0.0

1 year ago