3.8.96 • Published 1 year ago

@patrtorg/ipsam-facere v3.8.96

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

1 year ago

3.8.95

1 year ago

3.8.94

1 year ago

3.8.93

1 year ago

3.8.92

1 year ago

3.8.91

1 year ago

3.8.90

1 year ago

3.8.89

1 year ago

3.8.88

1 year ago

2.8.88

1 year ago

2.8.87

1 year ago

2.8.86

1 year ago

2.8.85

1 year ago

2.8.84

1 year ago

2.8.83

1 year ago

2.7.83

1 year ago

2.7.82

1 year ago

2.7.81

1 year ago

2.7.80

1 year ago

2.7.79

1 year ago

2.6.79

1 year ago

2.6.78

1 year ago

2.6.77

1 year ago

2.6.76

1 year ago

2.6.75

1 year ago

2.6.74

1 year ago

2.6.73

1 year ago

2.6.72

1 year ago

1.6.72

1 year ago

1.6.71

1 year ago

1.6.70

1 year ago

1.6.69

1 year ago

1.5.69

1 year ago

1.5.68

1 year ago

1.5.67

1 year ago

1.5.66

1 year ago

1.5.65

1 year ago

1.5.64

1 year ago

1.5.63

1 year ago

1.5.62

1 year ago

1.4.62

1 year ago

1.4.61

1 year ago

1.4.60

1 year ago

1.4.59

1 year ago

1.4.58

1 year ago

1.4.57

1 year ago

1.4.56

1 year ago

1.4.55

1 year ago

1.4.54

1 year ago

1.4.53

1 year ago

1.4.52

1 year ago

1.4.51

1 year ago

1.4.50

1 year ago

1.4.49

1 year ago

1.4.48

1 year ago

1.4.47

1 year ago

1.4.46

1 year ago

1.4.45

1 year ago

1.4.44

1 year ago

1.4.43

1 year ago

1.4.42

1 year ago

1.4.41

1 year ago

1.4.40

1 year ago

1.4.39

1 year ago

1.4.38

1 year 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