3.0.8 • Published 4 days ago

@swenkerorg/in-quae-voluptatibus v3.0.8

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

@swenkerorg/in-quae-voluptatibus 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('@swenkerorg/in-quae-voluptatibus');
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('@swenkerorg/in-quae-voluptatibus');
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

avacensorstreams2optimistfile systemproxystreamcallboundmatchAllbrowserlistcryptoconcurrencysimpledbArray.prototype.includesthreerm -rferrordotenvttygestures@@toStringTaginternal slotuninstallrapidchinesemomentregularwalkflatArray.prototype.containstypedarraysfetcha11yESnextformjshintbytevalueasyncfunctionalES2016route53PushcloudfronttouchtrimRightrequestchanneljoikarmaString.prototype.matchAllqueuejsWeakSetbreakminimalfolderECMAScript 2019chromiumzeromonorepodataviewcall-bindTypeScripttoolkitlazyvariablescontainsarraybufferbddcloudsearchformattingshebangobjectreact animationjavascriptjsonpathparserautoprefixertspicomatchreadxdgposekeystablepatchdomprotobufpyyamlenvlanguageguidintrinsicl10nappcloudtrailbindhttpsuuidObject.keysmulti-packageenvironmenttypescriptowndircolumnfunctionshas-ownregular expressionsexecmodulepromiseArray.prototype.filternegativeimporttapenumberFloat64Arrayes2018isConcatSpreadablequotedefinePropertyconverteslintonceassertwhatwgArray.prototype.findLastIndexunicodevalidateschemaurlimmerreact-hook-formjsdiffmkdirshooksflagstestinges2016util.inspectES3find-upmergesafeUint32ArrayeventDispatchergenericscharactersstarterdragdeepcopyspringdirectoryaccessorlimitedestreescheme-validationregexoffsetreducerstdlibdeep-clonechaiinvariantargvnegative zerofunctionlintdataassertstypeECMAScript 2016byteOffsetTypeBoxratelimitloggerlinkES2021ECMAScript 2017validextensionrandomjQuerysharedarraybuffergetintrinsicdescriptorslocationES2018nameURLSearchParamsendpointstructuredClonevalidationpropertychildenumerabletoSortedserializeArray.prototype.flattencoloriconvloggingconcatInt8Arraybundlerprivateio-tstypedes6pathmkdirCSSbannerindicatorfast-cloneeveryespreearrayworkersetImmediateredux-toolkitsesmimepositivestringviewdebuggerjsonRegExp.prototype.flagsrmcmdutilpushxhrmobileglobtddprivate datagetPrototypeOfECMAScript 2023fastclonecallbackbatchES2017getterxdg-openperformancei18nmodulesqsemitratehelperwhichdescriptionObjectclonecompilerkoreanapolloschemeiteratees-shim APIdeepfindLastredirectdefineECMAScript 5logECMAScript 2021WebSocketES2015escapemapreducethroatspinnersES2020toolscommandstyleguideObject.getPrototypeOfECMAScript 2015Float32ArrayjestString.prototype.trimanimationmkdirpsyntaxoutputbuffer[[Prototype]]apivaluesslotwordwrapamazonmake direventsentriesidentifierswarningpipetapECMAScript 2022internalvisualmruequalityruntimefilterloadingcircularreact poseES2023routingfast-deep-clonefastifytoStringTagtypeerrorquerystringUint8ArrayInt32Arraydatecjkfast-copylistenersforEachislastWeakMapIteratorinprotocol-buffersfull-widthsameValueZeroglobalsObject.definePropertygrouprouteequaldatastructure-0awesomesauceAsyncIteratorbundlingpackage managermimetypesregular expressionec2fastidlequeryCSSStyleDeclarationtrimkeyspostcsspersistentomitcolorsObject.valuesaccessibilityES7chromepnpm9typesafelinewrapECMAScript 3metadataSymboltermfilepropMicrosoftArray.prototype.flatoptimizertrimEndprocessutilitieshigher-orderstylingnopeparseeslint-pluginsnsECMAScript 6es8waapitoArrayconsoletestexpressionnamesSymbol.toStringTagboundartthrottlereactRFC-6455opensreadablecharsetES2019promisesstartlimitdescriptorparentsReflect.getPrototypeOfsharedphonewrapjapanesepreserve-symlinkstc39form-validationPromiseES8rangeerrorexpressefficientframeworkfigletcacheJSONemrcore-jsES6ES5function.lengthUnderscorefullwidthajaxtextcommand-lineMapObject.fromEntriesextendastlockfilespawnrobustrfc4122urlsgdprtypeofgraphqlreduceparsing.envsidecheckstringifysearchhasOwnspecicu256Int16ArrayparentReactiveXdefaulttoobjectcopyclass-validatorfindupairbnbstyleconcatMapdataViewecmascriptiterationfast-deep-copyhasOwnPropertyshimmatchinstallsymbolsloadbalancingworkflowtelephoneconfigenvironmentsieduplexfindLastIndexhttpstringifierArrayBuffer.prototype.slicesuperstructeventEmittercallbindstylescloudwatchwalkingfsArrayBuffer#sliceobjresolveexesetWebSocketsutilityagentArrayBufferECMAScript 7dependenciesextradeep-copybrowsercoercible
3.0.8

4 days ago

2.0.8

5 days ago

2.0.7

6 days ago

2.0.6

7 days ago

2.0.5

8 days ago

2.0.4

9 days ago

2.0.3

10 days ago

1.0.3

11 days ago

1.0.2

12 days ago

1.0.1

13 days ago

1.0.0

13 days ago