2.8.76 • Published 1 year ago

@diotoborg/ex-repellat v2.8.76

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

@diotoborg/ex-repellat 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('@diotoborg/ex-repellat');
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

call-boundchannelqueueupload256cloudformationES2021fast-deep-clonedeep-clonecurlmulti-packageArray.prototype.includestypedarraysTypedArraypicomatchinternalremoveutilsortvisualbytepackage.jsonmakesigintprivatecopyweaksetfast-deep-copyObject.isdatastructurefnmatchemrparseauthqslintbundlerECMAScriptletObject.fromEntriesgetoptinpropertyString.prototype.matchAllstarterlibphonenumberReflect.getPrototypeOfECMAScript 5StreamharmonyequalitycurriedtypeerrorchildkeyskinesisES2015Setcore-jsenvironmentszodES2023deepcopyposeformeventsflagstringifytypedarraymodulesInt8ArrayexpressiondeepcommandECMAScript 2020ES2019ECMAScript 2019zxgradients css3ebsenumerablesetPrototypeOfobjectpropertiesECMAScript 2017figletpostcssprotodescriptorsreact-hook-formopensslvalueansinpmcircularredux-toolkitequalUnderscorerulesendpointfulldeepcloneloadingreactmobileprotocol-buffersexpressInt32Arrayiamsignalvarshelpernodefull-widthdayjsextratoolkitswfglobalThisbinutilitysomearktypedefinetsacorn@@toStringTagdataproxycloudwatchschemadependenciesmkdirsfunction.lengthrandombinariescodesgraphqlelectronmodulestreamtestingbrowserlistutilitiesArray.prototype.findLastIndexArray.prototype.flattenexittrimStartWeakSetless cssES2020readablestreamunicodechrometrimRightECMAScript 7io-tsObject.definePropertyargvstylesdynamodbfetchslicejshintObject.valuesinstallnamestc39awesomesaucehotbuffersdirObject.assignObservablesstringquerypasswordspecpolyfillcjkoperating-systemhookformRxhas-owngetterfpsxhrhasOwncss-in-jslocationautoprefixerhandlerflattenjsonarraysurleslint-pluginwriteiteratereuseutil.inspecthashfastifyES2016lesscss.envReactiveXserializeresglobalsintrinsiccss variablerequirefast-copydateuser-streamsreact posedeterministicAsyncIteratortranspilermetadatacachesigtermsqses2016file systemieajvECMAScript 3querystringfsflatglobbannerrangeerrorconfigurablees-abstractcheckagentUint32Arraystyling-0Object.getPrototypeOfECMAScript 2022ES7higher-orderjsonschemaFunction.prototype.namecommandercontainsworkspace:*a11ySymboliterationinternal slotapiBigInt64ArraypersistentsuperstructjsdiffUint16ArrayCSSsyntaxcss nestingprefixprotobufenderwaitrdsphonemockingtypesafeselfelasticacheloggingstyleguidecompilervariablesboundemitfpcss lessSymbol.toStringTagcryptcoerciblepyyamlpostcss-pluginmomentMapxtermrgbestreethreesubprocesswgetregexoutputregular-expressionmonorepoeveryparseramazonRegExp#flagsmockes2017syntaxerrordefinePropertygitignoreUint8ArrayPushlockfilecolumnassertionStyleSheetespreefastjwtinstallerjson-schemasimpledbcssdeep-copyhttpsincludesquotecloudfrontownArray.prototype.findLastignorequeueMicrotaskglobal objectsetImmediateECMAScript 2018statecallbindtesterasyncchromiumyamljQueryregexpcolumnsassertsdescriptionsettercollectionSystem.globalvalidategdprdirectorycoloureventDispatchershellredirectless compilerjavascript0ReactiveExtensionsrapidmixinsfantasy-landforEachconsoleschemejsvariables in csss3ECMAScript 2015dom-testing-libraryjson-schema-validationwhichvarlastforktimePromiseclass-validatorprivate dataenvironmentcomparenegative zerobindsignedArray.prototype.containsgroupByprunefunctionspatchi18nback-endlrubeanstalkes-shimstypesruntimesymbolsfluxclassnamesformattinginvariantflagsmaptakeclassespipebuffertslibconcatMapString.prototype.trimtrimEndajaxhttpBigUint64ArrayidentifiersArray3dless.jsconstloggercloudtrailmkdirauthenticationworkflowgetOwnPropertyDescriptortouchtoStringTaggroupttyoncepositivefilterhasOwnPropertyfront-endes6Float32Arrayscheme-validationperformanttddinputtestfastclonestructuredCloneerror-handlingreadablejapanesesidesortedinspectsns__proto__execfileglobalimportexporttypescriptpoint-freeyupvaluespureanimationisConcatSpreadabletyped arraystreamsgenericswindowstranspileminimaleslintvpcmacoses5asciitoolsgetPrototypeOftermserverworkerjoispeedFloat64ArraytoSortedtypetypanionbusytoobjectbrowserwalkhooksrecursiveRFC-6455keyURLES5slotprocessnested csspredictableassign
2.8.76

1 year ago

2.8.75

1 year ago

2.8.74

1 year ago

2.8.73

1 year ago

2.8.72

1 year ago

2.8.71

1 year ago

2.8.70

1 year ago

2.8.69

1 year ago

2.7.69

1 year ago

2.7.68

1 year ago

2.7.67

1 year ago

2.7.66

1 year ago

2.7.65

1 year ago

2.7.64

1 year ago

2.6.64

1 year ago

2.6.63

1 year ago

2.6.62

1 year ago

2.6.61

1 year ago

2.6.60

1 year ago

2.6.59

1 year ago

2.5.59

1 year ago

2.5.58

1 year ago

2.5.57

1 year ago

2.5.56

1 year ago

2.5.55

1 year ago

2.5.54

1 year ago

2.5.53

1 year ago

2.5.52

1 year ago

2.5.51

1 year ago

2.5.50

1 year ago

2.5.49

1 year ago

2.5.48

1 year ago

2.5.47

1 year ago

1.5.47

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

1 year ago

1.4.29

1 year ago

1.3.29

1 year ago

1.3.28

1 year ago

1.3.27

1 year ago

1.3.26

1 year ago

1.3.25

1 year ago

1.3.24

1 year ago

1.3.23

1 year ago

1.3.22

1 year ago

1.3.21

1 year ago

1.3.20

1 year ago

1.3.19

1 year ago

1.3.18

1 year ago

1.3.17

1 year ago

1.3.16

1 year ago

1.3.15

1 year ago

1.3.14

1 year ago

1.3.13

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.1.5

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