3.8.96 • Published 10 months ago

@patrtorg/ipsam-facere v3.8.96

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

@patrtorg/ipsam-facere 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/ipsam-facere');
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

recursivereact-hook-formcallboundcall-bindworkflowkoreaneslint-pluginES2016function.lengthzeroasterisksaccessibilitynameinputdependenciesmulti-packagerangeerrorObject.fromEntriesslotoptimisthookstypeerrorback-endArray.prototype.flatMapjoiresolveeslintconfigemrquerystringtimestateworkspace:*symlinksminimalhas-ownstoragegatewayec2postcssjsonfshashpreserve-symlinksfull-widthdateajvawsUint8Arraycore-jseslintebscallprototypeECMAScript 2017ReactiveExtensionsredactcharacterrgbbundlergroupinterruptsautoscalingURLSearchParamsArray.prototype.flatbyteidlenegativeshamkeydom-0shimvariablesgradients css3findLastloadingswflistenersloadbalancingless.jsreact poseflatbufferMapcensorclipersistentInt32Arrayio-tsmapredux-toolkitfastcopytestersqssyntaxtranspilerdescriptorspnpm9argsfast-deep-copychildsimpledbmonorepotransportdotenvArray.prototype.findLastIndexBigUint64ArrayObservablenpmignoredirpasswordwidthIteratorirqWebSocketObject.assignECMAScript 5touchawesomesauceECMAScript 2020kinesisboundlengthinstallerwgetstyletypeECMAScript 2021slicearraybufferdeepclonequotetoSorteddeterministictschaiSettrimRightbinariestrimLefttranspilecolourprivate dataobjbyteOffsetenvironmentequalacorntypesmixinsrdssharedarraybufferES8css-in-jsairbnbglobal this valueCSSimmutablesymbol0regexpECMAScript 3circularES2023globalThisqueueMicrotaskreduceespreepluginPushartwhatwganimationreact-testing-librarytypesaferequireAsyncIteratormake dirbusykeysurllet_.extendpackagesjson-schemabrowserlisterror-handlingimportTypedArrayhandlerjson-schema-validationreduxsignalomitmapreducebcryptFloat64ArrayignoregestureswaitwhichiamRegExp#flagscomputed-typesrandomTypeBoxRFC-6455Uint16ArrayES2018writequeryeslintplugindayjses8ponyfillapolloArraymodulesesfastbrowserslistiterationpromiseECMAScript 2022concatformlibphonenumbersetPrototypeOfextendclientstylesheetunicodetypedperformantfigletfunctionprotobufglacierfastifyObject.getPrototypeOfString.prototype.matchAlltddlockfilestablenodejssameValueZeroi18nreal-timedeep-clonelinuxnopees2018xhrglobalsvpcperformancenodethreefileES2015validatecallbindsigintcolumnhasOwnfpviewforknumberintrinsicreactchineseflag.envoncefixed-widthopensslcodesrulesFunction.prototype.namewarningloggerES2021endercurlamazonmacosemites2017WeakSetjavascriptsuperstructArray.prototype.includessafefantasy-landentrieses-abstractpathtacitvarenvRxchannelarrayscoerciblemkdirpSymboliteratestarterreducersubprocessvaluereadablefpschromiumoptioncolorsexit-codebufferspolyfilltestdiffmockingsettingsJSON-SchemazxeventDispatcherutil.inspectredirecthelpersbinarystringifyuninstallimmertyped arraydom-testing-libraryfunctionsbannerhigher-orderroutinggradients csstrimStartUint8ClampedArrayuser-streamsconcatMapinstallfunctionaltoStringTagstructuredClonespawnserializeSymbol.toStringTagefficientsymlinkimportexporthelperBigInt64ArraytypeofObject.definePropertymoveparsergitignoreownregular expressiontypedarraypatchlanguagea11ybundling
3.8.96

10 months ago

3.8.95

10 months ago

3.8.94

10 months ago

3.8.93

10 months ago

3.8.92

10 months ago

3.8.91

10 months ago

3.8.90

10 months ago

3.8.89

10 months ago

3.8.88

10 months ago

2.8.88

10 months ago

2.8.87

10 months ago

2.8.86

10 months ago

2.8.85

10 months ago

2.8.84

10 months ago

2.8.83

10 months ago

2.7.83

11 months ago

2.7.82

11 months ago

2.7.81

11 months ago

2.7.80

11 months ago

2.7.79

11 months ago

2.6.79

11 months ago

2.6.78

11 months ago

2.6.77

11 months ago

2.6.76

11 months ago

2.6.75

11 months ago

2.6.74

11 months ago

2.6.73

11 months ago

2.6.72

11 months ago

1.6.72

11 months ago

1.6.71

11 months ago

1.6.70

11 months ago

1.6.69

11 months ago

1.5.69

11 months ago

1.5.68

11 months ago

1.5.67

11 months ago

1.5.66

11 months ago

1.5.65

11 months ago

1.5.64

11 months ago

1.5.63

11 months ago

1.5.62

11 months ago

1.4.62

11 months ago

1.4.61

11 months ago

1.4.60

11 months ago

1.4.59

11 months ago

1.4.58

11 months ago

1.4.57

12 months ago

1.4.56

12 months ago

1.4.55

12 months ago

1.4.54

12 months ago

1.4.53

12 months ago

1.4.52

12 months ago

1.4.51

12 months ago

1.4.50

12 months ago

1.4.49

12 months ago

1.4.48

12 months ago

1.4.47

12 months ago

1.4.46

12 months ago

1.4.45

12 months ago

1.4.44

12 months ago

1.4.43

12 months ago

1.4.42

12 months ago

1.4.41

12 months ago

1.4.40

12 months ago

1.4.39

12 months ago

1.4.38

12 months ago

1.4.37

1 year ago

1.4.36

1 year ago

1.4.35

1 year ago

1.4.34

1 year ago

1.4.33

1 year ago

1.4.32

1 year ago

1.4.31

1 year ago

1.3.31

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

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

1 year ago

1.2.16

1 year ago

1.2.15

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