1.12.68 • Published 2 years ago

@hishprorg/at-ipsum-molestiae v1.12.68

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

1.12.67

2 years ago

1.12.66

2 years ago

1.12.65

2 years ago

1.12.64

2 years ago

1.12.63

2 years ago

1.12.62

2 years ago

1.12.61

2 years ago

1.12.60

2 years ago

1.11.60

2 years ago

1.11.59

2 years ago

1.10.59

2 years ago

1.10.58

2 years ago

1.10.57

2 years ago

1.10.56

2 years ago

1.10.55

2 years ago

1.10.54

2 years ago

1.10.53

2 years ago

1.10.52

2 years ago

1.10.51

2 years ago

1.9.51

2 years ago

1.9.50

2 years ago

1.9.49

2 years ago

1.9.48

2 years ago

1.9.47

2 years ago

1.9.46

2 years ago

1.9.45

2 years ago

1.9.44

2 years ago

1.9.43

2 years ago

1.9.42

2 years ago

1.9.41

2 years ago

1.9.40

2 years ago

1.9.39

2 years ago

1.9.38

2 years ago

1.9.37

2 years ago

1.8.37

2 years ago

1.8.36

2 years ago

1.8.35

2 years ago

1.8.34

2 years ago

1.7.34

2 years ago

1.7.33

2 years ago

1.7.32

2 years ago

1.7.31

2 years ago

1.7.30

2 years ago

1.7.29

2 years ago

1.7.28

2 years ago

1.6.28

2 years ago

1.5.28

2 years ago

1.5.27

2 years ago

1.5.26

2 years ago

1.5.25

2 years ago

1.5.24

2 years ago

1.5.23

2 years ago

1.5.22

2 years ago

1.5.21

2 years ago

1.5.20

2 years ago

1.5.19

2 years ago

1.4.19

2 years ago

1.4.18

2 years ago

1.4.17

2 years ago

1.4.16

2 years ago

1.4.15

2 years ago

1.4.14

2 years ago

1.3.14

2 years ago

1.2.14

2 years ago

1.2.13

2 years ago

1.2.12

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago