🐛 Update: Added support for the 'find' command in settings.local.json. Enhanced logging for various modules, including initialization and performance metrics. Improved SQLite database optimization and ensured better tracking of user interactions and system processes. 📚

This commit is contained in:
2025-06-14 16:26:43 +02:00
parent ee54bc273c
commit 89037861e3
2472 changed files with 691099 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
# http://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{**/{actual,fixtures,expected,templates}/**,*.md}]
trim_trailing_whitespace = false
insert_final_newline = false

View File

@@ -0,0 +1,15 @@
{
"root": true,
"extends": "@ljharb/eslint-config/node/0.4",
"overrides": [
{
"files": "test/**/*.js",
"rules": {
"max-lines-per-function": "warn",
"max-nested-callbacks": "warn",
},
},
],
}

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/is-data-descriptor
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}

View File

@@ -0,0 +1,109 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.2](https://github.com/inspect-js/is-data-descriptor/compare/v2.1.1...v2.1.2) - 2023-10-25
### Commits
- [Refactor] use `hasown` [`77ad812`](https://github.com/inspect-js/is-data-descriptor/commit/77ad8129c7543f6826e2cbcadc015cc815ef94b7)
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`88f2cb7`](https://github.com/inspect-js/is-data-descriptor/commit/88f2cb744242131a98086967ea4a3c5d42c6fa77)
## [v2.1.1](https://github.com/inspect-js/is-data-descriptor/compare/v2.1.0...v2.1.1) - 2023-04-27
### Commits
- [Fix] when an object/key pair is provided, check arguments.length instead of key truthiness [`72692d3`](https://github.com/inspect-js/is-data-descriptor/commit/72692d3c1184e4d1f11faecbc9446b21cf5610a1)
- [readme] remove empty section [`72ec85b`](https://github.com/inspect-js/is-data-descriptor/commit/72ec85b9c4d781d551f19e595cca91b5f933d90d)
## [v2.1.0](https://github.com/inspect-js/is-data-descriptor/compare/v2.0.0...v2.1.0) - 2023-04-27
### Commits
- [eslint] cleanup [`c18a236`](https://github.com/inspect-js/is-data-descriptor/commit/c18a23640c00f32fca39112381b5cabdaa6a9a55)
- [Tests] travis -> Github Actions; add `safe-publish-latest`, `npmignore`, `auto-changelog`, `evalmd`, `aud` [`5758410`](https://github.com/inspect-js/is-data-descriptor/commit/5758410ec503add0727f2215633e5b1998c21293)
- [readme] clean up docs, URLs, package.json, etc [`28f61dd`](https://github.com/inspect-js/is-data-descriptor/commit/28f61dd676d8661ca7468e091ddf2e22bf4a8da2)
- [Docs] remove verb [`e20d28c`](https://github.com/inspect-js/is-data-descriptor/commit/e20d28cc86ce8a7cbc4beb0f306e5a4034b6d704)
- [Tests] convert from mocha to tape [`666c175`](https://github.com/inspect-js/is-data-descriptor/commit/666c1755f29668098dc07fbda0eb1d354a4da640)
- [New] increase support from node 6 down to node 0.4 [`aa43b69`](https://github.com/inspect-js/is-data-descriptor/commit/aa43b699b4a53b97e7af13f4d49eb7a21d253d99)
- [Tests] add coverage [`8f094f6`](https://github.com/inspect-js/is-data-descriptor/commit/8f094f6809514862f367c07bd879f2de42f4d9d0)
- [meta] switch from `files` field to npmignore; add `exports` [`2769e1d`](https://github.com/inspect-js/is-data-descriptor/commit/2769e1d408330b05331a40216e7a6bdce2322f69)
- [Deps] remove unused `kind-of` [`bc87bcd`](https://github.com/inspect-js/is-data-descriptor/commit/bc87bcd5f9abfa3ac8bcd2daf85ca9c380cb225d)
## [v2.0.0](https://github.com/inspect-js/is-data-descriptor/compare/v1.0.1...v2.0.0) - 2018-12-13
### Commits
- refactor [`8dcc492`](https://github.com/inspect-js/is-data-descriptor/commit/8dcc492bfb8e6d5b7964c1c566cdfe27ffbd8b0a)
## [v1.0.1](https://github.com/inspect-js/is-data-descriptor/compare/v1.0.0...v1.0.1) - 2023-10-26
### Commits
- [eslint] actually use eslint [`65fed07`](https://github.com/inspect-js/is-data-descriptor/commit/65fed07b2dde027da64f303c21a44a4375a2e2bd)
- [readme] clean up readme, remove verb [`10ad663`](https://github.com/inspect-js/is-data-descriptor/commit/10ad663093b0ed9c9c0c13c6db4ead4351b8670e)
- [meta] clean up package.json [`7f76a01`](https://github.com/inspect-js/is-data-descriptor/commit/7f76a015050fc87e9b394440c3b5283cf55b2c82)
- [meta] update `.gitignore` [`a2ca593`](https://github.com/inspect-js/is-data-descriptor/commit/a2ca593bb1173e73f23eb401e455249c71c2eda8)
- [Tests] switch to tape [`70540e5`](https://github.com/inspect-js/is-data-descriptor/commit/70540e5449ef3239051d4e40dce8a5a1978d1634)
- [Tests] migrate from travis to github actions [`eee138d`](https://github.com/inspect-js/is-data-descriptor/commit/eee138d84d57191310acf3e7fdc83f5951570188)
- [Fix] properly return false for an accessor descriptor [`2c213cd`](https://github.com/inspect-js/is-data-descriptor/commit/2c213cd67d558c169a02892dc52592ca1d5d8f40)
- [Performance] move data object to module level [`37688a1`](https://github.com/inspect-js/is-data-descriptor/commit/37688a1653f3a2a364f14bb396803413cb435963)
- [Fix] allow any non-primitive; arrays and functions are objects too [`197c77a`](https://github.com/inspect-js/is-data-descriptor/commit/197c77a39c53d12d7a091bcc029fcf7d75ce3a26)
- Only apps should have lockfiles [`20aa6e5`](https://github.com/inspect-js/is-data-descriptor/commit/20aa6e513aeb4bb84be63e278ce073c860deeade)
- [Robustness] switch to `hasown` [`aa48e2f`](https://github.com/inspect-js/is-data-descriptor/commit/aa48e2f61b3fb29e80cf655618d1573a21e8433e)
- [Fix] properly guard for-in loop [`014971e`](https://github.com/inspect-js/is-data-descriptor/commit/014971ea90715c2675511b89d05df00d4be10ecf)
- [Robustness] use a null object just in case [`ab05aad`](https://github.com/inspect-js/is-data-descriptor/commit/ab05aad03368d202505c4acde07ebc22f8da128d)
## [v1.0.0](https://github.com/inspect-js/is-data-descriptor/compare/v0.1.4...v1.0.0) - 2017-11-01
### Merged
- Update kind-of to version 6.0 [`#1`](https://github.com/inspect-js/is-data-descriptor/pull/1)
- Pin mocha to version 3 to support Node 0.12 [`#2`](https://github.com/inspect-js/is-data-descriptor/pull/2)
### Commits
- run update [`63e5992`](https://github.com/inspect-js/is-data-descriptor/commit/63e5992c6b953d652952cecb93468897ae8e5e29)
- update verb, generate readme documentation [`42dcba2`](https://github.com/inspect-js/is-data-descriptor/commit/42dcba2627fe655daa21aec843ca8de849f26cd6)
- minor edits [`23164cb`](https://github.com/inspect-js/is-data-descriptor/commit/23164cbc3496f7b13ec470781f05636ef610eecb)
## [v0.1.4](https://github.com/inspect-js/is-data-descriptor/compare/v0.1.3...v0.1.4) - 2015-12-28
### Fixed
- fixes https://github.com/jonschlinkert/is-descriptor/issues/2 [`#2`](https://github.com/jonschlinkert/is-descriptor/issues/2)
### Commits
- lint [`6d69a34`](https://github.com/inspect-js/is-data-descriptor/commit/6d69a34001d6191d7874cd28aebcdc5441f06f70)
- lint, update lazy-cache [`58bcd4e`](https://github.com/inspect-js/is-data-descriptor/commit/58bcd4ea72f000c83fb167024cf116d4c357440e)
- generate docs with verb [`e6317db`](https://github.com/inspect-js/is-data-descriptor/commit/e6317dbcb27a95281a60120bac83f5938dda4e2c)
- update docs [`fb2e768`](https://github.com/inspect-js/is-data-descriptor/commit/fb2e7689724ad948673734865999051aec2da552)
- generate docs [`bd0ea52`](https://github.com/inspect-js/is-data-descriptor/commit/bd0ea52c7a80223bedc90aadd43e466169907c2a)
- adds verb plugin [`7657b81`](https://github.com/inspect-js/is-data-descriptor/commit/7657b8188aa6fd003586bdb4e791e02dce21bc99)
## [v0.1.3](https://github.com/inspect-js/is-data-descriptor/compare/v0.1.2...v0.1.3) - 2015-10-04
### Commits
- files prop [`b0b7700`](https://github.com/inspect-js/is-data-descriptor/commit/b0b77004c51fec564e68bf6ff89fd4a169915d5b)
## [v0.1.2](https://github.com/inspect-js/is-data-descriptor/compare/v0.1.1...v0.1.2) - 2015-10-04
### Commits
- lazy-cache [`49a868c`](https://github.com/inspect-js/is-data-descriptor/commit/49a868c410a1651367315763e24c796e0b5127ce)
- update readme [`936d3f4`](https://github.com/inspect-js/is-data-descriptor/commit/936d3f4327f782c9e0d0ef120c68a81bb987ce72)
## v0.1.1 - 2015-08-31
### Commits
- first commit [`a1915ae`](https://github.com/inspect-js/is-data-descriptor/commit/a1915ae8a9a4a633d18630102264d266b6e08f08)
- 0.1.1 readme [`8fd6ad0`](https://github.com/inspect-js/is-data-descriptor/commit/8fd6ad0e1b49fa4a22293bfdd807762863afbd5e)
- 0.1.1 docs [`5e54369`](https://github.com/inspect-js/is-data-descriptor/commit/5e543699944b7ee5fe091399dc4186bcace47e3e)
- 0.1.1 docs [`8ec34af`](https://github.com/inspect-js/is-data-descriptor/commit/8ec34af8e80d0f8e386c6bff57e2e4b18d4e0afb)
- lint [`d265658`](https://github.com/inspect-js/is-data-descriptor/commit/d265658d986a688bf217461ca9c24d9c5300bdc8)

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,112 @@
# is-data-descriptor <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
> Returns true if a value has the characteristics of a valid JavaScript data descriptor.
## Install
Install with [npm](https://npmjs.com/):
```sh
$ npm install --save is-data-descriptor
```
## Usage
```js
var isDataDesc = require('is-data-descriptor');
var assert = require('assert');
```
## Examples
`true` when the descriptor has valid properties with valid values.
```js
// `value` can be anything
assert.equal(isDataDesc({ value: 'foo' }), true);
assert.equal(isDataDesc({ value: function () {} }), true);
assert.equal(isDataDesc({ value: true }), true);
```
`false` when not an object
```js
assert.equal(isDataDesc('a'), false);
assert.equal(isDataDesc(null), false);
```
`false` when the object has invalid properties
```js
assert.equal(isDataDesc({ value: 'foo', enumerable: 'baz' }), false);
assert.equal(isDataDesc({ value: 'foo', configurable: 'baz' }), false);
assert.equal(isDataDesc({ value: 'foo', get() {} }), false);
assert.equal(isDataDesc({ get() {}, value: 'foo' }), false);
```
`false` when a value is not the correct type
```js
assert.equal(isDataDesc({ value: 'foo', enumerable: 'foo' }), false);
assert.equal(isDataDesc({ value: 'foo', configurable: 'foo' }), false);
assert.equal(isDataDesc({ value: 'foo', writable: 'foo' }), false);
```
## 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).
```js
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
You might also be interested in these projects:
* [is-accessor-descriptor](https://npmjs.com/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.
* [is-descriptor](https://npmjs.com/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://npmjs.com/is-descriptor)
[package-url]: https://npmjs.org/package/is-data-descriptor
[npm-version-svg]: https://versionbadg.es/inspect-js/is-data-descriptor.svg
[deps-svg]: https://david-dm.org/inspect-js/is-data-descriptor.svg
[deps-url]: https://david-dm.org/inspect-js/is-data-descriptor
[dev-deps-svg]: https://david-dm.org/inspect-js/is-data-descriptor/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/is-data-descriptor#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/is-data-descriptor.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-data-descriptor.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-data-descriptor.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-data-descriptor
[codecov-image]: https://codecov.io/gh/inspect-js/is-data-descriptor/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-data-descriptor/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-data-descriptor
[actions-url]: https://github.com/inspect-js/is-data-descriptor/actions

View File

@@ -0,0 +1,43 @@
'use strict';
var hasOwn = require('hasown');
// data descriptor properties
var data = {
__proto__: null,
configurable: 'boolean',
enumerable: 'boolean',
writable: 'boolean',
};
module.exports = function isDataDescriptor(obj, prop) {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof prop === 'string') {
var val = Object.getOwnPropertyDescriptor(obj, prop);
return typeof val !== 'undefined';
}
if (
(!('value' in obj) && !('writable' in obj))
|| 'get' in obj
|| 'set' in obj
) {
return false;
}
for (var key in obj) { // eslint-disable-line no-restricted-syntax
if (
key !== 'value'
&& hasOwn(obj, key)
&& hasOwn(data, key)
&& typeof obj[key] !== data[key]
&& typeof obj[key] !== 'undefined'
) {
return false;
}
}
return true;
};

View File

@@ -0,0 +1,87 @@
{
"name": "is-data-descriptor",
"version": "1.0.1",
"description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.",
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production",
"prelint": "evalmd README.md",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/inspect-js/is-data-descriptor.git"
},
"keywords": [
"accessor",
"check",
"data",
"descriptor",
"get",
"getter",
"is",
"keys",
"object",
"properties",
"property",
"set",
"setter",
"type",
"valid",
"value"
],
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/is-data-descriptor/issues"
},
"homepage": "https://github.com/inspect-js/is-data-descriptor",
"contributors": [
"Jordan Harband (https://github.com/ljharb)",
"Jon Schlinkert (https://twitter.com/jonschlinkert)",
"Rouven Weßling (www.rouvenwessling.de)"
],
"dependencies": {
"hasown": "^2.0.0"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.3",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.2"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

View File

@@ -0,0 +1,67 @@
'use strict';
var test = require('tape');
var isDescriptor = require('../');
var noop = function () {};
test('isDescriptor', function (t) {
t.test('value type', function (st) {
st.notOk(isDescriptor('a'), 'string is not a descriptor');
st.notOk(isDescriptor(null), 'null is not a descriptor');
st.end();
});
t.test('should not be false when the object has unknown properties:', function (st) {
st.ok(isDescriptor({ value: 'foo', bar: 'baz' }));
st.ok(isDescriptor({ value: 'foo', bar: 'baz' }));
st.end();
});
t.test('should be false when the object has accessor properties', function (st) {
st.notOk(isDescriptor({ value: 'foo', get: noop }));
st.notOk(isDescriptor({ set: noop, value: noop }));
st.end();
});
t.test('should be true when the object has valid data-descriptor properties', function (st) {
st.ok(isDescriptor({ value: 'foo' }));
st.ok(isDescriptor({ value: noop }));
st.end();
});
t.test('should be false when valid properties are invalid types', function (st) {
st.notOk(isDescriptor({ value: 'foo', enumerable: 'foo' }));
st.notOk(isDescriptor({ value: 'foo', configurable: 'foo' }));
st.notOk(isDescriptor({ value: 'foo', writable: 'foo' }));
st.end();
});
t.test('should be true when a value is a valid data descriptor', function (st) {
st.ok(isDescriptor({ value: 'foo' }));
st.ok(isDescriptor({ writable: true }));
st.end();
});
t.test('should be false when the value is not a valid descriptor', function (st) {
st.notOk(isDescriptor('foo'));
st.notOk(isDescriptor({}));
st.notOk(isDescriptor({ configurable: true }));
st.notOk(isDescriptor({ enumerable: true }));
st.notOk(isDescriptor({
get: undefined,
set: undefined,
enumerable: true,
configurable: true,
}));
st.end();
});
t.end();
});