From ae336b0ce720096b2c6c53b062db3b6be2446fea Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 17 Nov 2023 00:30:36 +0700 Subject: [PATCH] Require Node.js 18 and add TypeScript types --- .editorconfig | 12 ++++ .eslintignore | 3 - .eslintrc.yml | 2 - .gitattributes | 1 + .github/workflows/main.yml | 21 ++++++ .gitignore | 7 +- .npmrc | 1 + .travis.yml | 86 ------------------------ HISTORY.md | 21 ------ LICENSE | 23 ------- README.md | 49 -------------- component.json | 10 --- index.d.ts | 11 +++ index.js | 74 ++++++--------------- license | 11 +++ package.json | 84 +++++++++++++---------- readme.md | 57 ++++++++++++++++ test.js | 133 +++++++++++++++++++++++++++++++++++++ test/.eslintrc.yml | 2 - test/merge.js | 129 ----------------------------------- 20 files changed, 317 insertions(+), 420 deletions(-) create mode 100644 .editorconfig delete mode 100644 .eslintignore delete mode 100644 .eslintrc.yml create mode 100644 .gitattributes create mode 100644 .github/workflows/main.yml create mode 100644 .npmrc delete mode 100644 .travis.yml delete mode 100644 HISTORY.md delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 component.json create mode 100644 index.d.ts create mode 100644 license create mode 100644 readme.md create mode 100644 test.js delete mode 100644 test/.eslintrc.yml delete mode 100644 test/merge.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1c6314a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 76b1021..0000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -.nyc_output -coverage -node_modules diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 1eece14..0000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -root: true -extends: standard diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..346585c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,21 @@ +name: CI +on: + - push + - pull_request +jobs: + test: + name: Node.js ${{ matrix.node-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: + - 20 + - 18 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test diff --git a/.gitignore b/.gitignore index f15b98e..239ecff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -.nyc_output/ -coverage/ -node_modules/ -npm-debug.log -package-lock.json +node_modules +yarn.lock diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10784f9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,86 +0,0 @@ -language: node_js -node_js: - - "0.6" - - "0.8" - - "0.10" - - "0.12" - - "1.8" - - "2.5" - - "3.3" - - "4.9" - - "5.12" - - "6.16" - - "7.10" - - "8.15" - - "9.11" - - "10.15" -sudo: false -dist: precise -cache: - directories: - - node_modules -before_install: - # Configure npm - - | - # Skip updating shrinkwrap / lock - npm config set shrinkwrap false - # Setup Node.js version-specific dependencies - - | - # eslint for linting - # - remove on Node.js < 6 - if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then - node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \ - grep -E '^eslint(-|$)' | \ - xargs npm rm --save-dev - fi - - | - # mocha for testing - # - use 1.x for Node.js < 0.8 - # - use 2.x for Node.js < 0.10 - # - use 3.x for Node.js < 6 - if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 8 ]]; then - npm install --save-dev mocha@1.21.5 - elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then - npm install --save-dev mocha@2.5.3 - elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then - npm install --save-dev mocha@3.5.3 - fi - - | - # nyc for coverage - # - remove for Node.js < 0.10 - # - use 10.x for Node.js < 4 - # - use 11.x for Node.js < 6 - if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then - npm rm --save-dev nyc - elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 4 ]]; then - npm install --save-dev nyc@10.3.2 - elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then - npm install --save-dev nyc@11.9.0 - fi - # Update Node.js modules - - | - # Prune & rebuild node_modules - if [[ -d node_modules ]]; then - npm prune - npm rebuild - fi -script: - - | - # Run test script, depending on nyc install - if npm -ps ls nyc | grep -q nyc; then - npm run-script test-cov - else - npm test - fi - - | - # Run linting, depending on eslint install - if npm -ps ls eslint | grep -q eslint; then - npm run-script lint - fi -after_script: - - | - # Upload coverage to coveralls if exists - if [[ -d .nyc_output ]]; then - npm install --save-dev coveralls@2 - nyc report --reporter=text-lcov | coveralls - fi diff --git a/HISTORY.md b/HISTORY.md deleted file mode 100644 index 486771f..0000000 --- a/HISTORY.md +++ /dev/null @@ -1,21 +0,0 @@ -1.0.1 / 2016-01-17 -================== - - * perf: enable strict mode - -1.0.0 / 2015-03-01 -================== - - * Add option to only add new descriptors - * Add simple argument validation - * Add jsdoc to source file - -0.0.2 / 2013-12-14 -================== - - * Move repository to `component` organization - -0.0.1 / 2013-10-29 -================== - - * Initial release diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 274bfd8..0000000 --- a/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Jonathan Ong -Copyright (c) 2015 Douglas Christopher Wilson - -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. diff --git a/README.md b/README.md deleted file mode 100644 index 3403f4a..0000000 --- a/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# merge-descriptors - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Merge objects using descriptors. - -```js -var thing = { - get name() { - return 'jon' - } -} - -var animal = { - -} - -merge(animal, thing) - -animal.name === 'jon' -``` - -## API - -### merge(destination, source) - -Redefines `destination`'s descriptors with `source`'s. The return value is the -`destination` object. - -### merge(destination, source, false) - -Defines `source`'s descriptors on `destination` if `destination` does not have -a descriptor by the same name. The return value is the `destination` object. - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg -[npm-url]: https://npmjs.org/package/merge-descriptors -[travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg -[travis-url]: https://travis-ci.org/component/merge-descriptors -[coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg -[coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master -[downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg -[downloads-url]: https://npmjs.org/package/merge-descriptors diff --git a/component.json b/component.json deleted file mode 100644 index 4deae43..0000000 --- a/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "merge-descriptors", - "description": "Merge objects using descriptors", - "version": "1.0.1", - "scripts": [ - "index.js" - ], - "repo": "component/merge-descriptors", - "license": "MIT" -} diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..df8f91f --- /dev/null +++ b/index.d.ts @@ -0,0 +1,11 @@ +/** +Merges "own" properties from a source to a destination object, including non-enumerable and accessor-defined properties. It retains original values and descriptors, ensuring the destination receives a complete and accurate copy of the source's properties. + +@param destination - The object to receive properties. +@param source - The object providing properties. +@param overwrite - Optional boolean to control overwriting of existing properties. Defaults to true. +@returns The modified destination object. +*/ +declare function mergeDescriptors(destination: T, source: U, overwrite?: boolean): T & U; + +export = mergeDescriptors; diff --git a/index.js b/index.js index f22ebab..51228e5 100644 --- a/index.js +++ b/index.js @@ -1,60 +1,26 @@ -/*! - * merge-descriptors - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ +'use strict'; -'use strict' +function mergeDescriptors(destination, source, overwrite = true) { + if (!destination) { + throw new TypeError('The `destination` argument is required.'); + } -/** - * Module exports. - * @public - */ + if (!source) { + throw new TypeError('The `source` argument is required.'); + } -module.exports = merge + for (const name of Object.getOwnPropertyNames(source)) { + if (!overwrite && Object.hasOwn(destination, name)) { + // Skip descriptor + continue; + } -/** - * Module variables. - * @private - */ + // Copy descriptor + const descriptor = Object.getOwnPropertyDescriptor(source, name); + Object.defineProperty(destination, name, descriptor); + } -var hasOwnProperty = Object.prototype.hasOwnProperty - -/** - * Merge the property descriptors of `src` into `dest` - * - * @param {object} dest Object to add descriptors to - * @param {object} src Object to clone descriptors from - * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties - * @returns {object} Reference to dest - * @public - */ - -function merge (dest, src, redefine) { - if (!dest) { - throw new TypeError('argument dest is required') - } - - if (!src) { - throw new TypeError('argument src is required') - } - - if (redefine === undefined) { - // Default to true - redefine = true - } - - Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName (name) { - if (!redefine && hasOwnProperty.call(dest, name)) { - // Skip descriptor - return - } - - // Copy descriptor - var descriptor = Object.getOwnPropertyDescriptor(src, name) - Object.defineProperty(dest, name, descriptor) - }) - - return dest + return destination; } + +module.exports = mergeDescriptors; diff --git a/license b/license new file mode 100644 index 0000000..c509d45 --- /dev/null +++ b/license @@ -0,0 +1,11 @@ +MIT License + +Copyright (c) Jonathan Ong +Copyright (c) Douglas Christopher Wilson +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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. diff --git a/package.json b/package.json index f051293..6a98ef4 100644 --- a/package.json +++ b/package.json @@ -1,38 +1,50 @@ { - "name": "merge-descriptors", - "description": "Merge objects using descriptors", - "version": "1.0.3", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com", - "twitter": "https://twitter.com/jongleberry" - }, - "contributors": [ - "Douglas Christopher Wilson ", - "Mike Grabowski " - ], - "license": "MIT", - "repository": "sindresorhus/merge-descriptors", - "devDependencies": { - "eslint": "5.9.0", - "eslint-config-standard": "12.0.0", - "eslint-plugin-import": "2.14.0", - "eslint-plugin-node": "7.0.1", - "eslint-plugin-promise": "4.0.1", - "eslint-plugin-standard": "4.0.0", - "mocha": "5.2.0", - "nyc": "13.1.0" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "README.md", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "test": "mocha test/", - "test-cov": "nyc --reporter=html --reporter=text npm test" - } + "name": "merge-descriptors", + "version": "1.0.3", + "description": "Merge objects using their property descriptors", + "license": "MIT", + "repository": "sindresorhus/merge-descriptors", + "funding": "https://github.com/sponsors/sindresorhus", + "contributors": [ + "Jonathan Ong ", + "Douglas Christopher Wilson ", + "Mike Grabowski ", + "Sindre Sorhus " + ], + "exports": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "main": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "engines": { + "node": ">=18" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "merge", + "descriptors", + "object", + "property", + "properties", + "merging", + "getter", + "setter" + ], + "devDependencies": { + "ava": "^5.3.1", + "xo": "^0.56.0" + }, + "xo": { + "rules": { + "unicorn/prefer-module": "off" + } + } } diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..33d516f --- /dev/null +++ b/readme.md @@ -0,0 +1,57 @@ +# merge-descriptors + +> Merge objects using their property descriptors + +## Install + +```sh +npm install merge-descriptors +``` + +## Usage + +```js +import mergeDescriptors from 'merge-descriptors'; + +const thing = { + get name() { + return 'John' + } +} + +const animal = {}; + +mergeDescriptors(animal, thing); + +console.log(animal.name); +//=> 'John' +``` + +## API + +### merge(destination, source, overwrite?) + +Merges "own" properties from a source to a destination object, including non-enumerable and accessor-defined properties. It retains original values and descriptors, ensuring the destination receives a complete and accurate copy of the source's properties. + +Merges properties of source into destination, redefining or defining them as necessary. + +Returns the modified `destination` object. + +#### destination + +Type: `object` + +The object to receive properties. + +#### source + +Type: `object` + +The object providing properties. + +#### overwrite + +Type: `boolean`\ +Default: `true` + +A boolean to control overwriting of existing properties. diff --git a/test.js b/test.js new file mode 100644 index 0000000..2dca306 --- /dev/null +++ b/test.js @@ -0,0 +1,133 @@ +const test = require('ava'); +const mergeDescriptors = require('./index.js'); + +const source = { + name: 'John', + surname: 'Doe', +}; + +Object.defineProperty(source, 'fullName', { + get() { + return `${this.name} ${this.surname}`; + }, +}); + +test('should copy property descriptors from source to destination', t => { + const destination = {}; + const source = {}; + + Object.defineProperty(source, 'name', { + value: 'AA', + }); + + t.false(Object.hasOwn(destination, 'name')); + + mergeDescriptors(destination, source); + + t.true(Object.hasOwn(destination, 'name')); + t.deepEqual(Object.getOwnPropertyDescriptor(destination, 'name'), { + value: 'AA', + writable: false, + enumerable: false, + configurable: false, + }); +}); + +test('should redefine when configurable', t => { + const destination = {}; + const source = {}; + + Object.defineProperty(destination, 'name', { + configurable: true, + value: 'AA', + }); + + Object.defineProperty(source, 'name', { + value: 'fido', + }); + + t.is(Object.getOwnPropertyDescriptor(destination, 'name').value, 'AA'); + t.is(Object.getOwnPropertyDescriptor(source, 'name').value, 'fido'); + + mergeDescriptors(destination, source); + + t.is(Object.getOwnPropertyDescriptor(destination, 'name').value, 'fido'); +}); + +test('should error when non-configurable', t => { + const destination = {}; + const source = {}; + + Object.defineProperty(destination, 'name', { + configurable: false, + value: 'AA', + }); + + Object.defineProperty(source, 'name', { + value: 'fido', + }); + + t.throws(() => { + mergeDescriptors(destination, source); + }, { + message: /Cannot redefine property: name/, + }); +}); + +test('should skip when overwrite is false', t => { + const destination = {}; + const source = {}; + + Object.defineProperty(destination, 'name', { + configurable: true, + value: 'AA', + }); + + Object.defineProperty(source, 'name', { + value: 'fido', + }); + + mergeDescriptors(destination, source, false); + + t.is(Object.getOwnPropertyDescriptor(destination, 'name').value, 'AA'); +}); + +test('should correctly copy getters and setters', t => { + const destination = {}; + const source = { + get name() { + return 'John'; + }, + set name(value) { + this._name = value; + }, + }; + + mergeDescriptors(destination, source); + + t.is(destination.name, 'John'); + destination.name = 'Jane'; + t.is(destination._name, 'Jane'); +}); + +test('should merge multiple properties', t => { + const destination = {age: 30}; + const source = {name: 'John', surname: 'Doe'}; + + mergeDescriptors(destination, source); + + t.deepEqual(destination, {name: 'John', surname: 'Doe', age: 30}); +}); + +test('should handle nested objects', t => { + const destination = {}; + const source = { + nested: { + value: 42, + }, + }; + + mergeDescriptors(destination, source); + + t.is(destination.nested.value, 42); +}); diff --git a/test/.eslintrc.yml b/test/.eslintrc.yml deleted file mode 100644 index 9808c3b..0000000 --- a/test/.eslintrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -env: - mocha: true diff --git a/test/merge.js b/test/merge.js deleted file mode 100644 index 5b4699a..0000000 --- a/test/merge.js +++ /dev/null @@ -1,129 +0,0 @@ -var assert = require('assert') -var merge = require('..') - -var source = { - name: 'John', - surname: 'Doe' -} - -Object.defineProperty(source, 'fullName', { - get: function () { - return this.name + ' ' + this.surname - } -}) - -describe('merge(dest, src)', function () { - describe('arguments', function () { - describe('dest', function () { - it('should be required', function () { - assert.throws(merge.bind(null, undefined), /argument dest is required/) - }) - - it('should reject null', function () { - assert.throws(merge.bind(null, null), /argument dest is required/) - }) - }) - - describe('src', function () { - it('should be required', function () { - assert.throws(merge.bind(null, {}, undefined), /argument src is required/) - }) - - it('should reject null', function () { - assert.throws(merge.bind(null, {}, null), /argument src is required/) - }) - }) - }) - - describe('when merging objects', function () { - it('should copy property descriptors from src to dest', function () { - var dest = {} - var src = {} - - Object.defineProperty(src, 'name', { - value: 'TJ' - }) - - assert.ok(!dest.hasOwnProperty('name')) - - merge(dest, src) - - assert.ok(dest.hasOwnProperty('name')) - assert.ok(Object.getOwnPropertyDescriptor(dest, 'name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(dest, 'name').value, 'TJ') - }) - - describe('when property exists in src', function () { - it('should redefine when configurable', function () { - var dest = {} - var src = {} - - Object.defineProperty(dest, 'name', { - configurable: true, - value: 'TJ' - }) - - Object.defineProperty(src, 'name', { - value: 'fido' - }) - - assert.ok(dest.hasOwnProperty('name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(dest, 'name').value, 'TJ') - assert.ok(src.hasOwnProperty('name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(src, 'name').value, 'fido') - - merge(dest, src) - - assert.ok(dest.hasOwnProperty('name')) - assert.ok(Object.getOwnPropertyDescriptor(dest, 'name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(dest, 'name').value, 'fido') - }) - - it('should error when non-configurable', function () { - var dest = {} - var src = {} - - Object.defineProperty(dest, 'name', { - configurable: false, - value: 'TJ' - }) - - Object.defineProperty(src, 'name', { - value: 'fido' - }) - - assert.ok(dest.hasOwnProperty('name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(dest, 'name').value, 'TJ') - assert.ok(src.hasOwnProperty('name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(src, 'name').value, 'fido') - - assert.throws(merge.bind(null, dest, src), /Cannot redefine property: name/) - }) - - it('should skip when redefine is false', function () { - var dest = {} - var src = {} - - Object.defineProperty(dest, 'name', { - configurable: true, - value: 'TJ' - }) - - Object.defineProperty(src, 'name', { - value: 'fido' - }) - - assert.ok(dest.hasOwnProperty('name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(dest, 'name').value, 'TJ') - assert.ok(src.hasOwnProperty('name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(src, 'name').value, 'fido') - - merge(dest, src, false) - - assert.ok(dest.hasOwnProperty('name')) - assert.ok(Object.getOwnPropertyDescriptor(dest, 'name')) - assert.strictEqual(Object.getOwnPropertyDescriptor(dest, 'name').value, 'TJ') - }) - }) - }) -})