2.0.15 • Published 11 days ago

@zitterorg/recusandae-explicabo v2.0.15

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

@zitterorg/recusandae-explicabo 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('@zitterorg/recusandae-explicabo');
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

byteLengthpluginprocesspathchromiumcall-boundprotobufminimalreduceconsoleshebangcreateRxJSURLsetlinkarktypeglobgetmodulesjsspinnersjshintFloat64ArraydebuggerinstrumentationString.prototype.matchAllMapsliceassertionpicomatchECMAScript 5deletefromtrimStartSystem.globalincludesxtermmatchbannerrdssettingsnegativeexpressionunicodedotenvdescriptionloggerECMAScript 7classnameTypeScriptjsdiffrsssubprocesskeysregexpstarterpreprocessoraccessorfeedglobalsenumerablemanagerletextrareal-timeansiYAMLObject.fromEntriesArrayBuffer#slicequeueMicrotaskautoprefixerfilterenvironmentargvschemebrowserlistvisualoptimizerdescriptorrmdirsearchselfchildpolyfilldeepclonedataWebSocketfullwhichcharacterredux-toolkites7point-freeuninstallgesturesbrowserslistObject.keysObject.isrequireWeakSetArray.prototype.findLastIndexredirectgroupautoscalinges8quotesymbolstapbundlingtrimRightsinatrawalkingframeworkargsArrayenvironmentslengthgitignoreFunction.prototype.namecssnegative zeroparsemonorepovestjapaneseMicrosoftterminalprivatehas-ownposejavascriptqueuefantasy-landES2023trim$.extendamazonwafsetPrototypeOfformsscheme-validationArray.prototype.flatMapphonees2018CSSStyleDeclarationobjutil.inspectlook-upelectronECMAScript 2021dependenciesfunctionsrapidcontainsavaflagsstringpostcssfetchutilsglobal this valuesomeRxStyleSheetaccessibilityredactpostcss-pluginendercommanderbddes2015characterscallbindECMAScript 2016RFC-6455syntaxerror[[Prototype]]valuecloudfrontsortrangeerrorfast-deep-clonebuffersrestbinaryroutingtslibes-shims_.extendreact poseebsstableArray.prototype.containsinhelpersdircomputed-typesrandomprivate dataes5toobjectjsxes2016errorCSSemojiUint8ClampedArrayqspurefunction.lengthfindlookzodStreamRegExp.prototype.flagsAsyncIteratortermendpointdeep-clonexmltransportarrayvarsproxylocalshrinkwrapUint8ArrayES2020stringifyfnmatchconcatagentzxownarttraverseoffsetmodule3dreact-hooksajaxdataViewprefixsharedarraybufferstreamscolumnslogponyfillUint16ArrayemitjsdomES3awesomesaucesimpledbsesidcodesObjectpopmotionreversejson-schematddpromisegraphqllistenerssyntaxthreewgetstructuredClonemochatypesObservablerobustreacthookformsource maproutelastmomentbrowserrouterReactiveXdragregular expressionses-shim APImkdirkeyfast-copygetintrinsiclocationmaphtmlargumentqueryloggingreact animationtextentriesreads3nativeregular expressionES2018pruneformattingcallbackassertswindowvaluescjkgenericsnpmwritabledebugreadablepnpm9schemaio-tspropertyhardlinksestreenodejsString.prototype.trimistanbulinstalltypedarraymapreducesqstoArraycode pointsprototypeforkexecfileequalitymkdirs256apichannelvalidatorfull-widthtranspileES6ECMAScript 2017classestapetsfunctionalfindLastconstpackagesWebSocketsJSONimportjQueryutilityelbserializerdeep-copyrm -fromitformatdynamodbinspectSymbolfolderflatfast-clonereact-hook-formJSON-SchemaEScore-jsequalapollohasOwnPropertySetassertobjectES7recursiveemrstreamindicatordirectorytakecollectionreadablestreamInt8ArraykinesisReflect.getPrototypeOfhelpersameValueZerocolourpipefpiteratoris.envurluuidserializationbindsuperstructworkflowbuffercopytoolscloudtrailguideventDispatcherpackagetostringtageslintpluginruntimeflatMapreversedObservablesdateRegExp#flagsInt32ArraytypedarrayscryptoclonenumbershamIteratoriterateiamSymbol.toStringTagmkdirpecmascriptfastcopyresolvejson-schema-validationes6elasticachefullwidthvariablesfilepatchrgbes2017everygetoptoutputpositivebeanstalktranspilercloudsearchtypedviewparserUint32ArrayUnderscorekoreananimationharmonydefineeslint-pluginloadingdropec2regularvpctouchgdprfastclonehasOwnchinesedeepproproute53slotexechttpssnslrucolorsrmmanipulationfile systemsetImmediatePromise-0ECMAScript 2023metadatalintinferenceswfzeroparentsttydom-testing-libraryfigletexpressatomECMAScript 2018fastifystringifierflattenform-validationsetterloadbalancingwaapibabel-corebusyramdatrimEndtoReversed0testcacheclassnamescalljoiObject.definePropertyfinduptelephonecliArray.prototype.flatonceregular-expressionArray.prototype.includeswebPushcloudwatchrequestgetterutil6to5styled-componentssymboleslintconfigacornjson-schema-validatorarraybuffermatchesinternal slotES5mobilestoragegatewayidlecollection.es6ajvspinnerperformancetypeofstyleguidespecwarningcolordiffWeakMapbinflageventswidthpropertiesescapestylefast-deep-copyprotocol-buffers@@toStringTagtypescriptvarreuseinternalbundlerrfc4122validationECMAScript 3pushjasminedependency managerparentfpsfixed-widthbabelECMAScript 6optionECMAScript 2020jsonschematyped arrayBigInt64ArrayassignformgroupByeast-asian-widthcommand-lineReactiveExtensionskarmahigher-ordertc39chromeignoreawsisConcatSpreadablecloudformationES2019definePropertya11yES8pinoconfigurablewaitenvquerystringhttpFloat32Arraycall-bindjsonshellcallboundtypenamesharedtypeerrorstylesprettytransformdeterministicasyncyamlcoercibleremovetesterfind-uptypaniontacitshimienopeupbyterulesglaciernpmignoreasterisksregexclass-validatorconsumeidentifierscompilernamesi18nefficientdayjsconfigdeepcopyES2016ESnextdataviewmulti-packageprotoweaksetutilitiesmake.gitignoreoptimistBigUint64ArraygetPrototypeOfyupperformantasciisymlinkstoStringTagpackage.jsonTypeBoxreduxES2017TypedArraymake dirspeedHyBicircularimmereslintObject.entriesesrm -rfintrinsictimehashboundserializereact-testing-librarylibphonenumberfunctionclientInt16ArraymergeinputmoveespreeextenddomreworkworkerES2022findLastIndexArrayBuffercolumnnodeECMAScript 2019comparearraystrimLeftArray.prototype.filtersuperagenthasgetOwnPropertyDescriptorcheckcurlcoreinvariantvalidatesafeECMAScriptglobal objectStreamsspringreducerweakmapeffect-tsbyteOffsetArray.prototype.findLastcoveragechaiairbnbArrayBuffer.prototype.slicelanguageECMAScript 2015progressObject.getPrototypeOfworkspace:*fscommandwhatwg
2.0.15

11 days ago

2.0.13

13 days ago

2.0.14

12 days ago

2.0.11

15 days ago

2.0.12

14 days ago

2.0.9

17 days ago

2.0.10

16 days ago

2.0.8

18 days ago

2.0.7

19 days ago

2.0.6

20 days ago

2.0.5

21 days ago

2.0.4

22 days ago

2.0.3

23 days ago

2.0.2

24 days ago

2.0.1

25 days ago

1.0.1

26 days ago

1.0.0

27 days ago