{"id":15686916,"url":"https://github.com/ljharb/define-data-property","last_synced_at":"2025-04-13T18:20:39.220Z","repository":{"id":194374633,"uuid":"689109338","full_name":"ljharb/define-data-property","owner":"ljharb","description":"Define a data property on an object. Will fall back to assignment in an engine without descriptors.","archived":false,"fork":false,"pushed_at":"2024-08-07T23:10:00.000Z","size":95,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T15:08:28.987Z","etag":null,"topics":["accessor","configurable","data","define","ecmascript","enumerable","javascript","object","property","writable"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ljharb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":"ljharb","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2023-09-08T20:30:24.000Z","updated_at":"2025-02-06T20:17:33.000Z","dependencies_parsed_at":"2024-02-14T22:27:32.931Z","dependency_job_id":"cb3f3256-b49b-478f-babe-be86928d7ee4","html_url":"https://github.com/ljharb/define-data-property","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"a622c13b78c72f88f0b41e886ef62551ba07485c"},"previous_names":["ljharb/define-data-property"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljharb%2Fdefine-data-property","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljharb%2Fdefine-data-property/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljharb%2Fdefine-data-property/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljharb%2Fdefine-data-property/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljharb","download_url":"https://codeload.github.com/ljharb/define-data-property/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248364220,"owners_count":21091543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessor","configurable","data","define","ecmascript","enumerable","javascript","object","property","writable"],"created_at":"2024-10-03T17:41:51.579Z","updated_at":"2025-04-13T18:20:39.180Z","avatar_url":"https://github.com/ljharb.png","language":"JavaScript","readme":"# define-data-property \u003csup\u003e[![Version Badge][npm-version-svg]][package-url]\u003c/sup\u003e\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nDefine a data property on an object. Will fall back to assignment in an engine without descriptors.\n\nThe three `non*` argument can also be passed `null`, which will use the existing state if available.\n\nThe `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment.\n\n## Usage\n\n```javascript\nvar defineDataProperty = require('define-data-property');\nvar assert = require('assert');\n\nvar obj = {};\ndefineDataProperty(obj, 'key', 'value');\ndefineDataProperty(\n\tobj,\n\t'key2',\n\t'value',\n\ttrue, // nonEnumerable, optional\n\tfalse, // nonWritable, optional\n\ttrue, // nonConfigurable, optional\n\tfalse // loose, optional\n);\n\nassert.deepEqual(\n\tObject.getOwnPropertyDescriptors(obj),\n\t{\n\t\tkey: {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: 'value',\n\t\t\twritable: true,\n\t\t},\n\t\tkey2: {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue: 'value',\n\t\t\twritable: true,\n\t\t},\n\t}\n);\n```\n\n[package-url]: https://npmjs.org/package/define-data-property\n[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg\n[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg\n[deps-url]: https://david-dm.org/ljharb/define-data-property\n[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg\n[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/define-data-property.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property\n[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property\n[actions-url]: https://github.com/ljharb/define-data-property/actions\n","funding_links":["https://github.com/sponsors/ljharb","https://ko-fi.com/ljharb"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljharb%2Fdefine-data-property","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljharb%2Fdefine-data-property","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljharb%2Fdefine-data-property/lists"}