4.11.95 • Published 10 months ago

@patrtorg/sunt-distinctio-illo v4.11.95

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@patrtorg/sunt-distinctio-illo 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('@patrtorg/sunt-distinctio-illo');
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

JSONtyped arraydayjscheckinputescapegitignorekeyqueueserializecommanderextendcontainsconcatfunctionreadPromisetypeformdeepprivateObject.isObject.fromEntriesmetadataObject.assignless mixinsswf.envtermmovehookformbufferserror-handlingPushstylecallbackoperating-systemlanguages3sameValueZerotouchenvhardlinksfasttoArrayassertsqueueMicrotaskfull-widthbootstrap csseslintconfigponyfillletconcatMaperrornested cssuninstallelbprettymobilecacheschemavarsshebangflagHyBiwgetsortedsymbolscliECMAScript 2018isConcatSpreadablelinkargslistenersdeepclonevalidationparseflagsbinariesES2020circularapilogES2021reducerjsxInt32ArrayObject.valuesasciitelephoneformattingArray.prototype.findLastIndextestinggroupmkdirplesscssprogressec2datetoolsFloat32ArrayspecpathcolourtypesconsolevalueArray.prototype.flatMapweakmapyupramdapluginmatchAll@@toStringTagmapdependenciesdom-testing-librarybrowserpipeclassesquerynopedomes2016mapreducedropexecutetoSortedsuperagentglobalcssgraphqlCSSECMAScript 2015postcsssqsnativeregularinternalfindLastIndexhasOwnPropertycreateamazongenericssyntaxgroupByroutingharmonyreact animationdefinePropertyhashelperpromise-0ArrayBufferreact-hooksloadbalancingWebSocketsgradients css3tostringtaginternal slotbootstrap lessdirapollotc39zodclassnamesignoreforkrulesArray.prototype.includesexitsliceiterationmergechromeform-validationreversecss lessansishellweaksetoptimisttoolkitbcryptdirectoryjapaneseprotocol-buffersAsyncIteratorfiltersymbolreduxclass-validatorpurees6Observablesmake dirjson-schema-validatorassignsideirqforEachguidcrypttranspilerpackage.jsonRFC-6455immerreadablestreambundlerInt8ArrayequalityUint8ArraystatelessES7typedESnext3ddiffissortregular-expressionjshintES2019RegExp#flagsasteriskswafconsumeinterruptspnpm9trimStartstyleguideworker$.extendutilregexpfast-copyvariables in cssstringES2017package managerpasswordasyncECMAScript 6spinnersagentes7oncechildutil.inspectECMAScript 5typeerrorbinjsdiffshrinkwrapajaxenvironmentssettingsfastcopyutilitiesinvariantjavascriptjsonschemaphonebrowserlistuploadES3json-schemaenvironmenthas-ownbrowserslistwhatwgsignalsendpointshamInt16ArrayautoscalingrgbObject.getPrototypeOfes-shim APIArray.prototype.filterarrays__proto__walk[[Prototype]]computed-typesglobalThisfunctionsMicrosoftclassnamehttpsurlnumberBigInt64Arrayperformantcollection.es6fast-clonecloudfrontRegExp.prototype.flagssuperstructnegative zerofindLastlinuxargvchineseutilsfileprotoieflatteninferencereact-hook-formURLmulti-packagevalidateES2016omitfunctionalstringifierfpsequalRxJSjsonArray.prototype.flattenastcolordataViewperformancereadableformattransportpoint-freegdprdeep-copyBigUint64Arraytrimxhrassertprocess6to5rapidzxYAMLSystem.globalspawnstarterzerovisualpyyamlcompilerECMAScript 2019transpileECMAScript 2016hooksmonorepoprivate dataCSSStyleDeclarationjoitextIteratorstylingcloneio-tsreact-componentcloudsearchautoprefixerESpositiveURLSearchParamsgesturespreserve-symlinkstoobjectstringifycoredescriptiontypescriptfixed-widthgetterregexStreamsString.prototype.matchAllelectroncss-in-jsbyteLengthsetnamemodulesrecursiveinenderawsreplayiteratesyntaxerrorecmascripthandlersnpmsharedpinoglacierjsECMAScriptmixinsArrayBuffer.prototype.slicecloudwatchchromiumparsingtakevalidatorttyvarfiglettypedarraysredactES2023stableArrayoutputbinaryviewrequestrobustfromawesomesaucematchstylesheetreduceebsacorncollectioncharacterflatMapexecfilereact poseECMAScript 2017writablemomentwarningwhichelmbabel-corethree.gitignoremrumkdirTypeScriptsetPrototypeOfUint32Arraytestaccessorreactlintcurlframerelasticacherfc9562cjkfullwidthObject.definePropertyimportlockfileresolvestructuredClonewaapiReflect.getPrototypeOfreact-testing-libraryeventDispatchergradients cssconfigurableuser-streamsiamWeakMaptslibfastclonemkdirspredictableObservableunicodeentriescurriedreusepicomatchbyteOffsetiteratorWebSocketinspectfsseslruextraexecbytegetintrinsicdependency managerenumerableyamlpropimmutabledescriptorsdeterministicfullglobalsES2018rfc4122sharedarraybufferpersistenthasOwnES5xtermquotecallcryptoutilityes5shimjwttraverseajvtypaniontdddeletefluxspeedtrimLefttacitestreeeast-asian-widthWeakSetemrlessquerystringtimearktypeexpressioneslint-pluginsafeesECMAScript 2023getOwnPropertyDescriptorbindsettersubprocessobjectscheme-validationpackagescompile lessloadingjson-schema-validationcss nestingES8Mapfile systemtypeofes-shimspopmotioneffect-tshotsignedminimalStreamless.jsObject.keyses-abstractdeep-cloneSetqscall-bindredux-toolkitcloudtrailfantasy-landmatchesdotenvlastArray.prototype.containsanimationbusycss variablea11yObject.entriessymlinkargumentterminalspinnerinstalltoReversedsetImmediatefindbufferpushidentifierscallboundcallbindfast-deep-copyUint8ClampedArrayschemeownReactiveXsnsES6localflatsigintfunction.lengthrdslivereversedclientincludespostcss-pluginReactiveExtensionsarraybufferartprototyperangeerrorES2022indicatorhelpersvalidnodedefinefast-deep-clonecodesdescriptores2017sequence
4.11.95

10 months ago

4.11.94

10 months ago

4.11.93

10 months ago

4.11.92

10 months ago

4.11.91

10 months ago

4.11.90

10 months ago

4.10.90

10 months ago

4.10.89

10 months ago

4.10.88

10 months ago

4.10.87

10 months ago

4.10.86

10 months ago

4.10.85

10 months ago

4.10.84

10 months ago

4.10.83

10 months ago

4.10.82

10 months ago

4.10.81

10 months ago

4.10.80

10 months ago

4.9.80

10 months ago

4.9.79

10 months ago

4.9.78

10 months ago

4.9.77

10 months ago

4.9.76

10 months ago

4.9.75

10 months ago

3.9.75

11 months ago

3.9.74

11 months ago

3.9.73

11 months ago

3.8.73

11 months ago

3.8.72

11 months ago

3.8.71

11 months ago

3.8.70

11 months ago

3.7.70

11 months ago

3.7.69

11 months ago

3.7.68

11 months ago

3.7.67

11 months ago

3.7.66

11 months ago

3.7.65

11 months ago

3.7.64

11 months ago

3.7.63

11 months ago

2.7.63

11 months ago

2.6.63

11 months ago

2.6.62

11 months ago

2.6.61

11 months ago

2.6.60

11 months ago

2.6.59

11 months ago

2.6.58

11 months ago

2.6.57

11 months ago

2.6.56

11 months ago

2.6.55

11 months ago

2.6.54

11 months ago

2.6.53

11 months ago

2.6.52

11 months ago

2.6.51

11 months ago

2.6.50

11 months ago

2.6.49

12 months ago

2.6.48

12 months ago

2.5.48

12 months ago

2.5.47

12 months ago

2.4.47

12 months ago

2.4.46

12 months ago

2.3.46

12 months ago

2.3.45

12 months ago

2.3.44

12 months ago

2.3.43

12 months ago

2.3.42

12 months ago

2.3.41

12 months ago

2.3.40

12 months ago

2.3.39

12 months ago

2.2.39

12 months ago

2.2.38

12 months ago

2.1.38

12 months ago

2.1.37

12 months ago

2.1.36

12 months ago

2.1.35

12 months ago

2.1.34

1 year ago

2.1.33

1 year ago

2.1.32

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.0.23

1 year ago

2.0.22

1 year ago

2.0.21

1 year ago

2.0.20

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.17

1 year ago

2.0.16

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago