{"id":20631123,"url":"https://github.com/qingyangmoke/deepquery","last_synced_at":"2025-04-15T18:35:22.729Z","repository":{"id":94240030,"uuid":"142136514","full_name":"qingyangmoke/deepquery","owner":"qingyangmoke","description":"javascript safety deep query 深度查询","archived":false,"fork":false,"pushed_at":"2019-10-29T21:21:43.000Z","size":21,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T22:38:34.137Z","etag":null,"topics":["javascript","query","safe"],"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/qingyangmoke.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":"2018-07-24T09:31:03.000Z","updated_at":"2020-08-28T12:08:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2efc35e-56fe-44a5-b8ed-c757afc0e82a","html_url":"https://github.com/qingyangmoke/deepquery","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.25,"last_synced_commit":"38fe8521cc2ae219f2f30dc57af2c66d43c3ac2f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingyangmoke%2Fdeepquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingyangmoke%2Fdeepquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingyangmoke%2Fdeepquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingyangmoke%2Fdeepquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qingyangmoke","download_url":"https://codeload.github.com/qingyangmoke/deepquery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610363,"owners_count":21132920,"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":["javascript","query","safe"],"created_at":"2024-11-16T14:11:13.975Z","updated_at":"2025-04-15T18:35:22.710Z","avatar_url":"https://github.com/qingyangmoke.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deepquery\n\u003e 深度拷贝\n\n## 安装\n```\n  npm i deepquery --save\n```\n\n## 使用\n``` js\nvar deepQuery = require('deepquery');\n```\nOR\n``` js\nimport deepQuery from 'deepquery';\n```\n\n``` js\n const obj = {\n      a: 1,\n      b: {\n        c: 2\n      },\n      items: [\n        {\n          name: 'item1',\n        }\n      ]\n };\n \n // 查询多层级节点\n deepQuery(obj, \"b\", \"c\"); // ==\u003e 2\n \n // 查询不存在的节点返回值为 undefined\n deepQuery(obj, \"b\", \"d\"); // ==\u003e undefined\n \n // 中间节点不存在 安全返回 undefined\n deepQuery(obj, \"notexists\", \"d\"); // ==\u003e undefined\n \n // 使用默认值 || ''  如果查询结果不存在则返回 空字符\n deepQuery(obj, \"b\", \"d\") || ''; // ==\u003e '' \n \n // 支持数组索引\n deepQuery(obj, \"items\", 0, 'name'); // ==\u003e item1\n deepQuery(obj, \"items\", 1, 'name') || ''; // ==\u003e ''\n \n // 对象是undefined\n const objUndefined;\n deepQuery(objUndefined, \"b\", \"items\", 1, 'name') || ''; // ==\u003e ''\n \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqingyangmoke%2Fdeepquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqingyangmoke%2Fdeepquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqingyangmoke%2Fdeepquery/lists"}