{"id":19946028,"url":"https://github.com/itsabdessalam/defaults-to","last_synced_at":"2026-06-06T13:31:05.866Z","repository":{"id":122675050,"uuid":"205536329","full_name":"itsabdessalam/defaults-to","owner":"itsabdessalam","description":"Check if a given value is not undefined, null or NaN else it returns default value","archived":false,"fork":false,"pushed_at":"2019-08-31T16:22:30.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T04:14:28.904Z","etag":null,"topics":["check","default","defaults","defaults-to","javascript","type","value"],"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/itsabdessalam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2019-08-31T11:36:09.000Z","updated_at":"2023-03-07T17:00:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac937b17-baaa-41c9-bd34-bfd2c3624ec0","html_url":"https://github.com/itsabdessalam/defaults-to","commit_stats":null,"previous_names":["abdessalam98/defaults-to"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itsabdessalam/defaults-to","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsabdessalam%2Fdefaults-to","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsabdessalam%2Fdefaults-to/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsabdessalam%2Fdefaults-to/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsabdessalam%2Fdefaults-to/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsabdessalam","download_url":"https://codeload.github.com/itsabdessalam/defaults-to/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsabdessalam%2Fdefaults-to/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33984824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["check","default","defaults","defaults-to","javascript","type","value"],"created_at":"2024-11-13T00:27:52.062Z","updated_at":"2026-06-06T13:31:05.828Z","avatar_url":"https://github.com/itsabdessalam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# defaults-to [![Build Status](https://travis-ci.com/Abdessalam98/defaults-to.svg?token=QqMEeU97cu6BFoo1RaKD\u0026branch=master)](https://travis-ci.com/Abdessalam98/defaults-to)\n\n\u003e Check if a given value is not undefined, null or NaN else it returns default value\n\n## Install\n\n```\n$ npm install defaults-to\n```\n\n## Usage\n\n```js\nconst defaultsTo = require(\"defaults-to\");\n\ndefaultsTo(undefined, 1);\n//=\u003e 1\ndefaultsTo(null, 1);\n//=\u003e 1\ndefaultsTo(NaN, 1);;\n//=\u003e 1\ndefaultsTo(\"value\", \"valueIfNotDefined\");\n//=\u003e \"value\"\ndefaultsTo(\"\", \"valueIfNotDefined\");\n//=\u003e \"\"\ndefaultsTo([1, 2, 3], []);\n//=\u003e [1, 2, 3]\ndefaultsTo({ a: 1, b: 2 }, {});\n//=\u003e { a: 1, b: 2 }\ndefaultsTo(null, []);\n//=\u003e []\ndefaultsTo(undefined, [])\n//=\u003e []\ndefaultsTo(null, {})\n//=\u003e {}\ndefaultsTo(undefined, {})\n//=\u003e {}\n```\n\n## License\n\nMIT © [Abdessalam BENHARIRA](https://abdessalam.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsabdessalam%2Fdefaults-to","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsabdessalam%2Fdefaults-to","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsabdessalam%2Fdefaults-to/lists"}