{"id":15853369,"url":"https://github.com/fabioricali/defaulty","last_synced_at":"2025-04-01T18:44:03.418Z","repository":{"id":96141731,"uuid":"100070377","full_name":"fabioricali/defaulty","owner":"fabioricali","description":"Copies deep missing properties to the target object","archived":false,"fork":false,"pushed_at":"2018-02-24T16:11:52.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-14T11:42:47.392Z","etag":null,"topics":["configuration","defaults","extend","javascript","merge-object","options"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabioricali.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-08-11T21:10:53.000Z","updated_at":"2017-09-20T20:59:28.000Z","dependencies_parsed_at":"2023-04-25T13:01:38.436Z","dependency_job_id":null,"html_url":"https://github.com/fabioricali/defaulty","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"69fd84c453349c4a157949986c75a103268dd602"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabioricali%2Fdefaulty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabioricali%2Fdefaulty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabioricali%2Fdefaulty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabioricali%2Fdefaulty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabioricali","download_url":"https://codeload.github.com/fabioricali/defaulty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237643133,"owners_count":19343367,"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":["configuration","defaults","extend","javascript","merge-object","options"],"created_at":"2024-10-05T19:04:34.709Z","updated_at":"2025-02-07T12:15:13.140Z","avatar_url":"https://github.com/fabioricali.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003edefaulty\u003c/h1\u003e\nCopies deep missing properties to the target object.\n\u003cbr/\u003e\u003cbr/\u003e\n\u003ca href=\"https://travis-ci.org/fabioricali/defaulty\" target=\"_blank\"\u003e\u003cimg src=\"https://travis-ci.org/fabioricali/defaulty.svg?branch=master\" title=\"Build Status\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/fabioricali/defaulty?branch=master\" target=\"_blank\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/fabioricali/defaulty/badge.svg?branch=master\u00261\" title=\"Coverage Status\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" title=\"License: MIT\"/\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/team-terrons-orange.svg\" title=\"Team Terrons\"/\u003e\n\u003c/div\u003e\n\n## Installation\n\n### Node.js\n```\nnpm install defaulty --save\n```\n\n## Example\n\n```javascript\nconst defaulty = require('defaulty');\n\nconst defaultObj = {a: 1, b: 2, c: 3, d: {a: 5, b: 2}};\nlet targetObj = {a: 4, b: 5, d: {a: 1}};\n\ndefaulty(targetObj, defaultObj);\n\nconsole.log(targetObj); //=\u003e {a: 4, b: 5, c: 3, d: {a: 1, b: 2}};\n```\n\n### Exclude default properties\n```javascript\nconst defaultObj = {a: 1, b: 2, c: 3, d: {a: 5, b: 2}, x: 1, y: 2};\nlet targetObj = {a: 4, b: 5, d: {a: 1}};\n\ndefaulty(targetObj, defaultObj, ['x', 'y']);\n\nconsole.log(targetObj); //=\u003e {a: 4, b: 5, c: 3, d: {a: 1, b: 2}};\n```\n\n### Copy target object\n```javascript\nconst defaultObj = {a: 1, b: 2, c: 3, d: {a: 5, b: 2}};\nconst targetObj = {a: 4, b: 5, d: {a: 1}};\n\nconst newTargetObject = defaulty.copy(targetObj, defaultObj);\n\nconsole.log(newTargetObject); //=\u003e {a: 4, b: 5, c: 3, d: {a: 1, b: 2}};\nconsole.log(targetObj); //=\u003e {a: 4, b: 5, d: {a: 1}};\n```\n\n## Changelog\nYou can view the changelog \u003ca target=\"_blank\" href=\"https://github.com/fabioricali/defaulty/blob/master/CHANGELOG.md\"\u003ehere\u003c/a\u003e\n\n## License\nDefaulty is open-sourced software licensed under the \u003ca target=\"_blank\" href=\"http://opensource.org/licenses/MIT\"\u003eMIT license\u003c/a\u003e\n\n## Author\n\u003ca target=\"_blank\" href=\"http://rica.li\"\u003eFabio Ricali\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabioricali%2Fdefaulty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabioricali%2Fdefaulty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabioricali%2Fdefaulty/lists"}