1.0.0 • Published 1 year ago

@bobyzgirlllnpm/facilis-dolores-reprehenderit v1.0.0

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

@bobyzgirlllnpm/facilis-dolores-reprehenderit Version Badge

github actions coverage License Downloads

npm badge

Returns true if a value has the characteristics of a valid JavaScript data descriptor.

Examples

true when the descriptor has valid properties with valid values. false when not an object or when the object has invalid properties.

var isDataDesc = require('@bobyzgirlllnpm/facilis-dolores-reprehenderit');
var assert = require('assert');

assert.equal(true, isDataDesc({ value: 'foo' }));
assert.equal(true, isDataDesc({ value: function () {} }));
assert.equal(true, isDataDesc({ value: true }));

assert.equal(false, isDataDesc('a'));
assert.equal(false, isDataDesc(null));
assert.equal(false, isDataDesc([]));

assert.equal(false, isDataDesc({ value: 'foo', bar: 'baz' }));
assert.equal(false, isDataDesc({ value: 'foo', bar: 'baz' }));
assert.equal(false, isDataDesc({ value: 'foo', get: function () {} }));
assert.equal(false, isDataDesc({ get: function () {}, value: 'foo' }) );
 
assert.equal(false, isDataDesc({ value: 'foo', enumerable: 'foo' }));
assert.equal(false, isDataDesc({ value: 'foo', configurable: 'foo' }));
assert.equal(false, isDataDesc({ value: 'foo', writable: 'foo' }));

Valid properties

The only valid data descriptor properties are the following:

  • configurable (required)
  • enumerable (required)
  • value (optional)
  • writable (optional)

To be a valid data descriptor, either value or writable must be defined.

Invalid properties

A descriptor may have additional invalid properties (an error will not be thrown).

var foo = {};

Object.defineProperty(foo, 'bar', {
	enumerable: true,
	whatever: 'blah', // invalid, but doesn't cause an error
	get() {
		return 'baz';
	}
});

assert.equal(foo.bar, 'baz');

Related projects

  • is-accessor-descriptor: Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.
  • is-descriptor: Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… more

Tests

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

callbindpackagesArrayBuffer.prototype.sliceargvconsumefull-widthESnext[[Prototype]]tsfindLastIndexpicomatchprivateclassnamestakeTypedArraylimitedIteratorextendconcatMapassertionES6stablerangeerrorrobustobjectesmake dirjoiregular expressionstrimLeftparsingincludescolumnspropertieses7chineseecmascriptonceroutecodesECMAScript 2017compile lesskoreanObject.fromEntriesefficientwordbreakcode pointsprunecharactersdescriptorasciithroatratelimitenvworkspace:*es6Array.prototype.containswebtrimStartstreams2AsyncIteratorshellECMAScript 3immutabletypedarraysES3queryhelpersbyteOffsetcryptoextensionStyleSheetmulti-packagenumberjsonpathauthmruzodrapidcall-boundES2022Float32ArrayjwtcurlgetfluxhttpsarraybufferECMAScript 6styleguideiteraterateoptionredux-toolkites2015mixinsvariables in cssECMAScript 5colourmimetypesqueueMicrotaskjapanesesetterbannernested cssgettergroupansiObject.getPrototypeOftestingpasswordmatchtypescriptschemereact-hook-formES2016regular expressiondataviewshrinkwraptoobjectECMAScript 2016requestcss-in-jslrusnsURLSearchParamsclassnameendpointlastprotoRegExp.prototype.flagsclass-validatorroutingMicrosoftwatchgetPrototypeOfcloudfrontgraphqlfpsObject.definePropertyargumentparserform-validationsetPrototypeOfreadableparentsfseventsInt32ArraypolyfillmochaisObject.assigntc39descriptorsbuffersvalidatexhrdataViewcss variableweakmapremoveprotobufprivate dataloadingsearchinvariantArray.prototype.findLastIndexES7randomSymbol.toStringTagWeakMapinstallsqsdataflatMapwgetmapreducecssgroupByTypeBoxtoStringTagtimeassertsdropisConcatSpreadablelesspnpm9copyfindupfileresolveamazoncomparemiddlewarespinnersfastclonejestgdprartcensorchaieverydependency managerwrapxtermowncallboundcollection.es6typeerrornodeReactiveXfindwatchingsymbolparseString.prototype.matchAllsuperagentoptimistfsstarterjsdomlogsetgetintrinsicproxyenderelectronfasts3es2017whichFunction.prototype.namesesoutputfunctionalreadArray.prototype.flattenrgblooklistenersmkdirstyped arrayuninstallpreserve-symlinkshigher-ordertestcommand-lineObject.entrieswarningWebSocketbatchvieweventEmitterbufferconcatObject.keysvaluesRxchannel256statelessfixed-widthsafeelmfile systemaccessorcss nestingbrowserlistpackage.jsonbundlingdeterministicECMAScript 7cloudwatchsyntaxerrorflat_.extendreuseduplexreal-timeshebangdeepArrayeslintconfigstateRegExp#flagsdeleteelbfullzerowalkyuphardlinksjssetImmediatemergeutildeep-copybytewaitexecmaketddStreamreactfromECMAScript 2023less cssassignajvMapmetadatacloudsearchmodulesSetdirectoryec2i18ncollectioncomputed-typesconfigcircularcore-jshttplazydomconfigurableWeakSetconcurrencywatchFilereduxarrayWebSocketsmoduleqsenumerablebreakguidstringifiertoSortedYAMLjsdiffdefinePropertyes2016ObservablescallbackbrowserslistnopeES2021styled-componentsdiffaccessibilityoptimizerio-tswidtheventDispatcherstructuredCloneuuidString.prototype.trim0loggingcompilerclitouchshimminimalrfc4122mkdirgetoptquerystringbcryptawesomesauceconnecthasha11ygetOwnPropertyDescriptores-abstractspecdeepclonetesterlocationwordwrapfast-copywalkingcorsbusyBigUint64Arraycryptsymlinksmatchesbootstrap lessJSONrecursiveclassesvestcss lesstypeofArray.prototype.includesvalidauthenticationworkeremojireplaytoolkit-0karmaformspropvariablesstdlibawsless mixinsreadablestreamforEachStreamspersistentqueueURLprogressbundlertypesargsmobilethrottleruntimestreamsutil.inspecttextiteratorObjectapiECMAScript 2015lintencryptionlockfilesettingstrimRightfigletes8redactprefixperformance$.extendtypedarrayreducerdirless compilerflattensymlinkstylesheetes-shim APIRFC-6455calldescriptionES2018deepcopyestreeponyfillformttyquotestylesiamjQueryrdsinspect.envhotPushsortnegative zeroebscharacterbrowseromitawaitrm -rfserializeoffsetavaindicatorstylingSymbolRxJSstringsidefastcopycjkl10nprotocol-bufferswatcherunicodepositivechromiumstreamvalueInt8ArrayserializationstyleUint8ClampedArraymonorepouploadbalancingshamregexpES8someequalitypackagemovehasOwnECMAScript 2021waftypeinferencees-shimsES2023asynceslint-pluginliveframeworktoolsformathas-ownespreefunctionsarrayscheckrmCSSStyleDeclarationcolorcolorsES5syntaxdebuggerclientrmdirpushstringifypredictablenpmtypesafeinhookformregexextradayjssorteddatelook-upECMAScript 2022taskmime-dbcachereact-testing-libraryhookslesscssapollocorenodejses5writemimedatastructureJSON-Schemaeslintreact-hooksweaksetjasmineless.jsdependencieskeysslicebeanstalkpackage managerpluginemitObject.valuestraverseintrinsicprettyArray.prototype.findLastvpcUint8ArrayESgradients cssfilterdom-testing-libraryajaxbyteLengthfullwidthbindentriesdeep-clonecommanderflagES2020ArrayBufferpatchlibphonenumbermkdirptslibhaslinewrapformattingeast-asian-widtheventscloudtrailbluebirdfolderObject.isargparseObservablefetchinstalleres2018whatwgidpromisecommandautoprefixervisualkinesisUint16Arrayreducebootstrap cssbddimportexportelasticachegradients css3rm -frfunctionlengthutilityES2015arktyperoute53agentpostcssjsonPromiseinternal slotphonesharedarraybuffersequenceglacierFloat64ArrayES2017parentcall-bindrequireES2019idlenegativecloneArray.prototype.filtertoArrayemrInt16Arraymomentaststoragegatewaytapairbnbinputswfcreatepostcss-pluginlanguageopenwritableschemafast-deep-cloneescapesuperstructworkflowexpresssymbolsArrayBuffer#sliceiterationprototypeArray.prototype.flatautoscalingutilitieshasOwnPropertytermdynamodbfind-upnamesimpledbloggerpipeTypeScriptequalboundlinkjavascriptgenericsobjECMAScript 2019trimEndfast-cloneredirecttypedconsoleexpressionimmervalidation@@toStringTagcolumnpathHyBiBigInt64Array
1.0.0

1 year ago