{"_id":"dash-get","_rev":"4074461","name":"dash-get","description":"A tiny get function, similar to Lodash.get","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"itsjonq","email":""}],"time":{"modified":"2025-10-13T19:29:18.000Z","created":"2018-12-01T23:34:35.287Z","1.0.2":"2019-01-09T17:35:51.666Z","1.0.1":"2018-12-02T22:21:52.295Z","1.0.0":"2018-12-01T23:34:35.287Z"},"users":{},"author":{"name":"Jon Quach","email":"hello@jonquach.com","url":"https://jonquach.com"},"repository":{"type":"git","url":"git+https://github.com/itsjonq/dash-get.git"},"versions":{"1.0.2":{"name":"dash-get","version":"1.0.2","description":"A tiny get function, similar to Lodash.get","main":"dist/index.js","scripts":{"build":"npm run clean && npm run build:ts && npm run build:minify && npm run build:postclean","build:ts":"tsc","build:minify":"uglifyjs dist/index.js --output dist/index.js --compress --mangle","build:postclean":"rm -rf dist/__tests__","clean":"rm -rf dist","dev":"npm run test -- --watch","git:push":"git push --follow-tags","release":"npm version","version":"npm run build","postversion":"npm publish && npm run git:push","test":"jest"},"author":{"name":"Jon Quach","email":"hello@jonquach.com","url":"https://jonquach.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/itsjonq/dash-get.git"},"bugs":{"url":"https://github.com/itsjonq/dash-get/issues"},"keywords":["get","dash","tiny","lodash","dash-get","object","value"],"devDependencies":{"@types/jest":"23.3.10","jest":"23.6.0","ts-jest":"23.10.5","typescript":"3.2.1","uglify-js":"3.4.9"},"gitHead":"14ede5a9bc13d9646dcb8229433c2f35175a8423","homepage":"https://github.com/itsjonq/dash-get#readme","_id":"dash-get@1.0.2","_npmVersion":"6.5.0","_nodeVersion":"8.11.4","_npmUser":{"name":"itsjonq","email":"hello@jonquach.com"},"dist":{"shasum":"4c9e9ad5ef04c4bf9d3c9a451f6f7997298dcc7c","size":3411,"noattachment":false,"key":"/dash-get/-/dash-get-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/dash-get/download/dash-get-1.0.2.tgz"},"maintainers":[{"name":"itsjonq","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dash-get_1.0.2_1547055351057_0.7074303564541786"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-21T03:59:14.828Z","publish_time":1547055351666,"_cnpm_publish_time":1547055351666},"1.0.1":{"name":"dash-get","version":"1.0.1","description":"A tiny get function, similar to Lodash.get","main":"dist/index.js","scripts":{"build":"npm run clean && npm run build:ts && npm run build:minify && npm run build:postclean","build:ts":"tsc","build:minify":"uglifyjs dist/index.js --output dist/index.js --compress --mangle","build:postclean":"rm -rf dist/__tests__","clean":"rm -rf dist","dev":"npm run test -- --watch","git:push":"git push --follow-tags","release":"npm version","version":"npm run build","postversion":"npm publish && npm run git:push","test":"jest"},"author":{"name":"Jon Quach","email":"hello@jonquach.com","url":"https://jonquach.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/itsjonq/dash-get.git"},"bugs":{"url":"https://github.com/itsjonq/dash-get/issues"},"keywords":["get","dash","tiny","lodash","dash-get","object","value"],"devDependencies":{"@types/jest":"23.3.10","jest":"23.6.0","ts-jest":"23.10.5","typescript":"3.2.1","uglify-js":"3.4.9"},"gitHead":"86297a89a237b5fc09b7c9efc2086e0e2188ac13","homepage":"https://github.com/itsjonq/dash-get#readme","_id":"dash-get@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"8.11.4","_npmUser":{"name":"itsjonq","email":"hello@jonquach.com"},"dist":{"shasum":"db751ea1b6a884ad06ac1efa982fd608e06977d2","size":3427,"noattachment":false,"key":"/dash-get/-/dash-get-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/dash-get/download/dash-get-1.0.1.tgz"},"maintainers":[{"name":"itsjonq","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dash-get_1.0.1_1543789312149_0.32942249178098115"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-21T03:59:14.736Z","publish_time":1543789312295,"_cnpm_publish_time":1543789312295},"1.0.0":{"name":"dash-get","version":"1.0.0","description":"A tiny get function, similar to Lodash.get","main":"dist/index.js","scripts":{"build":"npm run clean && npm run build:ts && npm run build:minify && npm run build:postclean","build:ts":"tsc","build:minify":"uglifyjs dist/index.js --output dist/index.js --compress --mangle","build:postclean":"rm -rf dist/__tests__","clean":"rm -rf dist","dev":"npm run test -- --watch","git:push":"git push --follow-tags","release":"npm version","version":"npm run build","postversion":"npm publish && npm run git:push","test":"jest"},"author":{"name":"Jon Quach","email":"hello@jonquach.com","url":"https://jonquach.com"},"license":"MIT","keywords":["get","tiny","lodash"],"devDependencies":{"@types/jest":"23.3.10","jest":"23.6.0","ts-jest":"23.10.5","typescript":"3.2.1","uglify-js":"3.4.9"},"gitHead":"75b39ecdb8bcc8cf67e23f73a4de9d18761f0f4d","_id":"dash-get@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.11.4","_npmUser":{"name":"itsjonq","email":"hello@jonquach.com"},"dist":{"shasum":"16ea677f141c3e3c3fef1b342a9cf914115e5d85","size":3241,"noattachment":false,"key":"/dash-get/-/dash-get-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/dash-get/download/dash-get-1.0.0.tgz"},"maintainers":[{"name":"itsjonq","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dash-get_1.0.0_1543707275162_0.7554863776708467"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-21T03:59:13.870Z","publish_time":1543707275287,"_cnpm_publish_time":1543707275287}},"readme":"# ✊ (dash) get\n\n[![Build Status](https://travis-ci.org/ItsJonQ/dash-get.svg?branch=master)](https://travis-ci.org/ItsJonQ/dash-get)\n[![npm version](https://badge.fury.io/js/dash-get.svg)](https://badge.fury.io/js/dash-get)\n\n> A tiny get function', similar to Lodash.get\n\n## ✨ Features\n\n- **Zero dependencies**!\n- Super tiny, at ~200 bytes gzipped\n- Works almost exactly like [Lodash.get](https://lodash.com/docs/4.17.11#get)\n- Ultra speedy! Check out the [performance tests](https://jsperf.com/get-try-catch-vs-reduce-vs-lodash-get)\n\n## ???? Installation\n\nAdd `dash-get` to your project via `npm install`:\n\n```\nnpm install --save dash-get\n```\n\n## ???? Usage\n\nYou can easily retrieve a value from a (deeply) nested object with `dash-get`, like so:\n\n```js\nimport get from 'dash-get'\n\nconst someObject = {...}\n\nconst deeplyNestedValue = get(someObject, 'the.path.to.the.nested.value')\n// value\n```\n\nThe path could also be an `Array`:\n\n```js\nconst someObject = {...}\n\nconst deeplyNestedValue = get(someObject, ['the', 'path', 'to', 'the', 'nested', 'value'])\n// value\n```\n\n## ???? API\n\n#### `get(obj, path, fallback)`\n\n| Argument | Type                     | Description                                                           |\n| -------- | ------------------------ | --------------------------------------------------------------------- |\n| obj      | `Object`                 | The object to get the value from.                                     |\n| path     | `Array<string>`/`string` | The path to the value.                                                |\n| fallback | `any`                    | The fallback value, in case the desired value could not be retrieved. |\n\n## ???? Unsupported feature\n\nThis module does not support this particular use case:\n\n```\nget(object, 'a[0].b.c')\n```\n\n## ???? Why an npm module tho?\n\nYou totally don't have to `npm install` this. This exists for convenience purposes ????.\n\nIn fact, it's encouraged that you add the `get` code to your code base! One less depenency to install and manage.\n\nHere it is!\n\n```js\nfunction get(obj, path, fallback) {\n  if (!obj || !path) return fallback;\n  const paths = Array.isArray(path) ? path : path.split(\".\");\n  let results = obj;\n  let i = 0;\n\n  while (i < paths.length && results !== undefined && results !== null) {\n    results = results[paths[i]];\n    i++;\n  }\n\n  if (i === paths.length) {\n    return results !== undefined ? results : fallback;\n  }\n\n  return results !== undefined && results !== null ? results : fallback;\n}\n```\n\n## ❤️ Thanks\n\nThanks to [@knicklabs](https://github.com/knicklabs) for pairing with me on this one!\n","_attachments":{},"homepage":"https://github.com/itsjonq/dash-get#readme","bugs":{"url":"https://github.com/itsjonq/dash-get/issues"},"license":"MIT"}