1.10.70 • Published 1 year ago

@hishprorg/ut-voluptatem v1.10.70

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

@hishprorg/ut-voluptatem 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('@hishprorg/ut-voluptatem');
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

core-jsnopemixinsdotenverrorqueryslotdomJSON-Schemaglobaljson-schemanegativecjkdiffsetImmediatecoercibleeverydescriptionspeedWebSocketswaitscheme-validationpredictablegetOwnPropertyDescriptorgettercss nestingminimaldataviewhas-ownuninstalleslintpluginkoreanStyleSheethelpersfetchES8pureasterisksarraybufferfixed-widthfrombootstrap lessreducerECMAScript 2017reduceextraObject.assigncolorbcryptfilterpnpm9shimWeakMapredirectcallbindelasticachetypedarraysrgbfullwidthajvcoresimpledbbrowserlistglobMapgetoptnodecss-in-jsserializerserializationsettergetjsonschemaconfigurablerdsECMAScript 2018accessibilityconfigshrinkwrapphonefast-deep-copycloudwatchprettyArray.prototype.containsmanagercolorses2018autoscalingObservableliveArraywafstreamsstylesheetECMAScript 2023escommanderES2016validationtypedarraycharacterarktypewhichfast-deep-clonextermpackagespoint-freeeventEmittercall-bindback-endchromecallqssafemovecurriedrouteES2018routinggetintrinsicbinimporttrimEndasciiindicatoruser-streamsfastcopyhttpfast-clonereal-timefullloggerservicedeepclonereuselibphonenumbermulti-packagefunctionpersistentclioptimistES2017directoryregexpes6superagentSetframerwhatwgtypeerrorjsdommapinspectdefineexpresskinesisvestES2022symbolremovevalidRegExp.prototype.flagsRx__proto__typeofbabel-coreTypeScriptefficientpromisetesting6to5varstermisConcatSpreadableenvironmentsbyteLengthinvariantpushcompile lessajaxless compilerdom-testing-libraryvisualmomentreactchecktrimStartcryptosharedarraybufferHyBipathenvSystem.globalutilityarraysserverStreamsutilses8irqoncebeanstalkomitECMAScript 2015npmignoreroute53Array.prototype.flattenhashtypesafeprototypelockfiledateforkeventsbootstrap cssbrowserslistgroupfileJSONwidthprogresslesscssregexmetadataECMAScript 2020css variablestylingclassnamestoSortedincludesconsumeformattingemitAsyncIteratortrimRightdeep-clonestyletoStringTagtostringtagObject.valuesfunctionscallbackvpciamimmutablekeysless mixinsmergemapreducelastArrayBufferdependency managerSymbolcommand-line$.extendimmercolumnssyntaxerrorhelperTypedArrayTypeBoxtransportflatMapthreeECMAScript 5Array.prototype.findLastIndexrequiretestES6assigndeep-copyregular-expressiongenericsfluxURLSearchParamschildspecinstallbundlingPromiseruntimeescapeignore
1.10.70

1 year ago

1.10.69

1 year ago

1.10.68

1 year ago

1.10.67

1 year ago

1.10.66

1 year ago

1.10.65

1 year ago

1.10.64

1 year ago

1.10.63

1 year ago

1.10.62

1 year ago

1.10.61

1 year ago

1.10.60

1 year ago

1.10.59

1 year ago

1.10.58

1 year ago

1.9.58

1 year ago

1.9.57

1 year ago

1.9.56

1 year ago

1.9.55

1 year ago

1.9.54

1 year ago

1.9.53

1 year ago

1.9.52

1 year ago

1.9.51

1 year ago

1.9.50

1 year ago

1.9.49

1 year ago

1.9.48

1 year ago

1.9.47

1 year ago

1.8.47

1 year ago

1.8.46

1 year ago

1.8.45

1 year ago

1.8.44

1 year ago

1.8.43

1 year ago

1.8.42

1 year ago

1.8.41

1 year ago

1.7.41

1 year ago

1.6.41

1 year ago

1.6.40

1 year ago

1.6.39

1 year ago

1.6.38

1 year ago

1.6.37

1 year ago

1.6.36

1 year ago

1.6.35

1 year ago

1.6.34

1 year ago

1.6.33

1 year ago

1.6.32

1 year ago

1.5.32

1 year ago

1.5.31

1 year ago

1.5.30

1 year ago

1.5.29

1 year ago

1.5.28

1 year ago

1.5.27

1 year ago

1.5.26

1 year ago

1.5.25

1 year ago

1.5.24

1 year ago

1.5.23

1 year ago

1.4.23

1 year ago

1.4.22

1 year ago

1.4.21

1 year ago

1.4.20

1 year ago

1.4.19

1 year ago

1.4.18

1 year ago

1.4.17

1 year ago

1.4.16

1 year ago

1.4.15

1 year ago

1.4.14

1 year ago

1.4.13

1 year ago

1.3.13

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago