1.12.68 • Published 1 year ago

@hishprorg/at-ipsum-molestiae v1.12.68

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

@hishprorg/at-ipsum-molestiae 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/at-ipsum-molestiae');
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

es5deterministicpromisesignalseventDispatcherpatchimmutablecallbackprotosymlinkurltypeoflesscsscompile lessidle$.extendwafletcolourJSON-SchemaoncequeueMicrotaskendpointtoobjectartmonorepoec2viewInt16ArraystoragegatewayclonemoveargumentbabelReactiveXhashselfhardlinksdiffvariables in cssclassnamesiteratorInt8ArrayStyleSheetmatchtypeprocesses2016sortedcolumnArrayBuffer#slicereducersetImmediateESstringifyserializerArray.prototype.filterECMAScript 2016Observablevalidreact animationjsonmkdirpcollectionoptimistiteratetsclass-validatorfunctionalpipeECMAScript 5point-freeprogresstranspileres8ECMAScript 2015protobufdirectorycallbindglobdataViewprototypetaciteffect-tstesterisamazonpreserve-symlinksbuffersReactiveExtensionslintthreeomitoffsetserializeajvdescriptorshebangcircularpluginzxvestobjecttraversees2017extralastspringObject.getPrototypeOfWebSocketcommand-linedeepcopynegative zerojshintfixed-widthdatastructuremanagerObservablesfluxwalkArray.prototype.findLastIndexrfc9562koreancurriedargvpyyamldeepgraphqlestreeawsgetoptkinesisenvironmentjsdiffsharedinterruptsECMAScript 2021Symbolprotocol-bufferslruwidthES2015cliSymbol.toStringTagrandomHyBiformsredactfileregularaccessibilitysafepropertiesopensslsuperstructbootstrap lessmatchescloudfrontreduxdropweaksetqueuehookspackage managerBigUint64Arrayhotstateless256shrinkwrapObject.valuesdescriptorsbundlerTypeBoxlocaleslint-pluginpasswordhas-ownYAMLnumberbootstrap cssES2019computed-typesgradients css3guidramdagetignorereal-timees7mobilecryptroute53parsejsdomES8consolephonetranspilestatehttpsglobalThisUnderscorefast-deep-cloneES6zodinstallertypescriptoperating-systemes-shimsutilequalityIteratorECMAScript 2018makepropertyURLSearchParamscall-boundconfigurablees-abstractpnpm9loadbalancingnegativebeanstalkquerystringweakmapStreamspolyfilles2018schemadombabel-coreastauthenticationstreampostcssjQuerymomentconcatObject.assignES2022settingscollection.es6popmotiondeleteawesomesauceboundbindBigInt64Arraycacherulesstyled-componentsswfforkcsscss-in-jsinputhandlerscloudwatchspinnersgdprfpcolorstestingvarinstall-0ES3httpgenericssqsAsyncIteratorelectronglobalcontainseventEmitterchromiumvaluefullES2020whichauthxterminspectreact-hookswaapievery
1.12.68

1 year ago

1.12.67

1 year ago

1.12.66

1 year ago

1.12.65

1 year ago

1.12.64

1 year ago

1.12.63

1 year ago

1.12.62

1 year ago

1.12.61

1 year ago

1.12.60

1 year ago

1.11.60

1 year ago

1.11.59

1 year ago

1.10.59

1 year ago

1.10.58

1 year ago

1.10.57

1 year ago

1.10.56

1 year ago

1.10.55

1 year ago

1.10.54

1 year ago

1.10.53

1 year ago

1.10.52

1 year ago

1.10.51

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.9.46

1 year ago

1.9.45

1 year ago

1.9.44

1 year ago

1.9.43

1 year ago

1.9.42

1 year ago

1.9.41

1 year ago

1.9.40

1 year ago

1.9.39

1 year ago

1.9.38

1 year ago

1.9.37

1 year ago

1.8.37

1 year ago

1.8.36

1 year ago

1.8.35

1 year ago

1.8.34

1 year ago

1.7.34

1 year ago

1.7.33

1 year ago

1.7.32

1 year ago

1.7.31

1 year ago

1.7.30

1 year ago

1.7.29

1 year ago

1.7.28

1 year ago

1.6.28

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.5.22

1 year ago

1.5.21

1 year ago

1.5.20

1 year ago

1.5.19

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.3.14

1 year ago

1.2.14

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago