{"id":18296230,"url":"https://github.com/ruanyl/ensure-keys","last_synced_at":"2025-04-09T08:42:49.218Z","repository":{"id":28896265,"uuid":"32421001","full_name":"ruanyl/ensure-keys","owner":"ruanyl","description":null,"archived":false,"fork":false,"pushed_at":"2015-03-18T20:45:10.000Z","size":140,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T13:47:28.973Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ruanyl.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}},"created_at":"2015-03-17T21:18:56.000Z","updated_at":"2015-03-18T20:45:10.000Z","dependencies_parsed_at":"2022-08-24T11:00:24.941Z","dependency_job_id":null,"html_url":"https://github.com/ruanyl/ensure-keys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruanyl%2Fensure-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruanyl%2Fensure-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruanyl%2Fensure-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruanyl%2Fensure-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruanyl","download_url":"https://codeload.github.com/ruanyl/ensure-keys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008550,"owners_count":21032553,"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":[],"created_at":"2024-11-05T14:39:56.467Z","updated_at":"2025-04-09T08:42:49.189Z","avatar_url":"https://github.com/ruanyl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ensure-keys\n========\n[![build status](https://secure.travis-ci.org/ruanyl/ensure-keys.svg)](http://travis-ci.org/ruanyl/ensure-keys)\n[![NPM version](https://badge.fury.io/js/ensure-keys.svg)](http://badge.fury.io/js/ensure-keys)\n\nensure a json has specific keys\n\n## Installation\n\nThis module is installed via npm:\n\n``` bash\n$ npm install ensure-keys --save\n```\n\n## Example Usage\n\n``` js\nvar ensureKeys = require('ensure-keys');\n\nvar json = {\n  name: 'bigruan',\n  age: 12,\n  child: {\n    name: 'yulong',\n    age: 1\n  }\n}\n// return the keys that not exists or has value: undefined, null and ''\nensureKeys(json, ['name', 'job', 'child.name']); // -\u003e ['job']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruanyl%2Fensure-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruanyl%2Fensure-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruanyl%2Fensure-keys/lists"}