3.6.101 • Published 10 months ago

@taktikorg/fuga-inventore v3.6.101

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

@taktikorg/fuga-inventore 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('@taktikorg/fuga-inventore');
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

global objectxmlflattenRegExp#flagswebhelperboundcloudfrontObject.isreact animationnativeincludescurlbrowserslisttoobjectarraybufferprotomomentgitignoreutilsreact-testing-librarypropertyloggingstreamrestfulES2016jestArrayObject.valueses2018koreanclassnamedebuggertypanionextraFunction.prototype.namejsondeep-clone6to5robustWeakMapstyleArray.prototype.flattenimmutableinstallHyBicloudformationsesresolvefastclonetransportserializerflattranspileredirectec2real-timedayjstermrouteflaghookselbprotocol-buffersa11ycensortypedarraysclientroute53hardlinksserializefileownasciilinkgesturesrapidObservablescheme-validationfullwidthstreamsindicatorfeedvarsredactregular expressionasterrorObject.definePropertysameValueZeroaccessornegative zeroclassnamesparsepinoasteriskscallbindmodulesmanagerjson-schema-validatorhas-ownendpointwhichregular-expressioncoveragetacitremoveURLSearchParamscjkdescriptormodulehasOwnPropertytostringtaghigher-orderparentsprefix256ECMAScript 2017JSON-Schemaesefficienttddbrowserlistmakefast-copyrsssliceprototypetelephoneES6binarypropertiesfastcopyavacopyTypeBox__proto__internal slotpostcssestreecsschromiumyamles-shimsreadablenumberomitaccessibilitytraversees-shim APImovereverseloadbalancingsomemergelocalshambeanstalkbin0guidnodejsbuffersobjectcliclassessource mapstoragegatewayes8testerquoteiamcollectiones6waitunicode_.extendbundlinglockfiledescriptionletfnmatchstringartselfbannerdomsymbolsinferencereact poseawselectroneast-asian-width.gitignorepnpm9takecode pointsassignflatMaptypeESnextES2015jsonschemathreelookgetintrinsichookformbabelajaxglobalThispreprocessorutil.inspectbundlerECMAScript 2018queueMicrotaskmobilevariablesrecursiveWebSocketescapeformseveryqscloudwatchcurriedIteratorInt16Arraytestingjson-schema-validationregexpECMAScriptnegativeflagsshimdeep-copyRxiteratorreworkecmascriptredux-toolkitvalueeslintpluginyupwritebyteOffsetregular expressionseslint-pluginformattingschemewidthimportexportjsdiffpositiveRFC-6455metadatamatchAllwindowsuperstructes5loggercallboundreducerarktypewalkingfilterglacierreversedimmerzodpackage.jsonbufferspinnerscorevalidatorfromwgetvalidcharactersglobalRxJS.envuninstallenvironmentjasminechannelgdprenumerableECMAScript 2019findLastprettycolorsutilReflect.getPrototypeOfenvironmentsl10ndynamodbcloudtrailprivate datagetcircularspringes2017
3.6.101

10 months ago

3.6.100

10 months ago

3.5.100

10 months ago

3.5.99

10 months ago

3.5.98

10 months ago

3.5.97

10 months ago

3.5.96

10 months ago

3.5.95

10 months ago

3.5.94

11 months ago

3.5.93

11 months ago

3.5.92

11 months ago

3.5.91

11 months ago

3.5.90

11 months ago

3.5.89

11 months ago

3.5.88

11 months ago

3.5.87

11 months ago

3.5.86

11 months ago

3.5.85

11 months ago

3.5.84

11 months ago

3.5.83

11 months ago

3.5.82

11 months ago

3.5.81

11 months ago

3.5.80

11 months ago

3.5.79

11 months ago

3.5.78

11 months ago

3.5.77

11 months ago

3.5.76

11 months ago

3.4.76

11 months ago

3.4.75

11 months ago

3.4.74

11 months ago

3.4.73

11 months ago

3.4.72

11 months ago

3.4.71

11 months ago

3.4.70

11 months ago

3.4.69

11 months ago

3.4.68

11 months ago

3.3.68

11 months ago

3.3.67

11 months ago

3.3.66

12 months ago

3.3.65

12 months ago

3.3.64

12 months ago

3.3.63

12 months ago

3.3.62

12 months ago

3.3.61

12 months ago

3.3.60

12 months ago

3.3.59

12 months ago

3.3.58

12 months ago

3.3.57

12 months ago

3.3.56

12 months ago

3.3.55

12 months ago

3.3.54

12 months ago

3.3.53

12 months ago

3.3.52

12 months ago

3.3.51

12 months ago

3.3.50

12 months ago

3.3.49

12 months ago

3.3.48

12 months ago

3.3.47

12 months ago

3.3.46

1 year ago

3.3.45

1 year ago

3.3.44

1 year ago

3.3.43

1 year ago

3.3.42

1 year ago

3.3.41

1 year ago

3.3.40

1 year ago

3.3.39

1 year ago

3.3.38

1 year ago

3.3.37

1 year ago

3.3.36

1 year ago

3.3.35

1 year ago

3.3.34

1 year ago

2.3.34

1 year ago

2.3.33

1 year ago

2.3.32

1 year ago

2.3.31

1 year ago

2.3.30

1 year ago

2.3.29

1 year ago

2.3.28

1 year ago

2.3.27

1 year ago

2.3.26

1 year ago

2.3.25

1 year ago

1.3.25

1 year ago

1.3.24

1 year ago

1.3.23

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago