{"_id":"@cjser/dot-prop__v8_0_2","name":"@cjser/dot-prop__v8_0_2","dist-tags":{"latest":"8.0.2-cjser.2"},"versions":{"8.0.2-cjser.2":{"name":"@cjser/dot-prop__v8_0_2","version":"8.0.2-cjser.2","description":"Get, set, or delete a property from a nested object using a dot path","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsc","bench":"node benchmark.js"},"keywords":["object","prop","property","dot","path","get","set","delete","access","notation","dotty"],"dependencies":{"type-fest":"^3.8.0"},"devDependencies":{"ava":"^5.2.0","benchmark":"^2.1.4","expect-type":"^0.15.0","typescript":"^5.0.4","xo":"^0.54.1"},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"8.0.2","cjserVersion":2,"original":{"name":"dot-prop","version":"8.0.2","exports":"./index.js","repository":"sindresorhus/dot-prop","dependencies":{"type-fest":"^3.8.0"},"files":["index.js","index.d.ts"],"scripts":{"test":"xo && ava && tsc","bench":"node benchmark.js"}}},"_id":"@cjser/dot-prop__v8_0_2@8.0.2-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-L2RmqSzsX38MrNYvRyO6Jf3oo/r8DqT5o9o2i+mJirvkALAPFfeIzL2Knycfl1GmN+E6X6Diezc3iATzMrGYbw==","shasum":"91ad9e288b9bafbcbea01f247b38643290b5e7b0","tarball":"https://registry.npmjs.org/@cjser/dot-prop__v8_0_2/-/dot-prop__v8_0_2-8.0.2-cjser.2.tgz","fileCount":6,"unpackedSize":26128,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDebBZ8Xx19ri9CHN604lDO2+eK13aHI6ZAxJN0x41suQIgWAcLpuRx2GkANam1hCG/V34O2SiCXx+mlpkBPmCEcJ0="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dot-prop__v8_0_2_8.0.2-cjser.2_1778157882344_0.5831449970855966"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T12:44:41.161Z","8.0.2-cjser.2":"2026-05-07T12:44:42.495Z","modified":"2026-05-07T12:44:42.764Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Get, set, or delete a property from a nested object using a dot path","keywords":["object","prop","property","dot","path","get","set","delete","access","notation","dotty"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"# dot-prop\n\n> Get, set, or delete a property from a nested object using a dot path\n\n## Install\n\n```sh\nnpm install dot-prop\n```\n\n## Usage\n\n```js\nimport {getProperty, setProperty, hasProperty, deleteProperty} from 'dot-prop';\n\n// Getter\ngetProperty({foo: {bar: 'unicorn'}}, 'foo.bar');\n//=> 'unicorn'\n\ngetProperty({foo: {bar: 'a'}}, 'foo.notDefined.deep');\n//=> undefined\n\ngetProperty({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value');\n//=> 'default value'\n\ngetProperty({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\\\.dot');\n//=> 'unicorn'\n\ngetProperty({foo: [{bar: 'unicorn'}]}, 'foo[0].bar');\n//=> 'unicorn'\n\n// Setter\nconst object = {foo: {bar: 'a'}};\nsetProperty(object, 'foo.bar', 'b');\nconsole.log(object);\n//=> {foo: {bar: 'b'}}\n\nconst foo = setProperty({}, 'foo.bar', 'c');\nconsole.log(foo);\n//=> {foo: {bar: 'c'}}\n\nsetProperty(object, 'foo.baz', 'x');\nconsole.log(object);\n//=> {foo: {bar: 'b', baz: 'x'}}\n\nsetProperty(object, 'foo.biz[0]', 'a');\nconsole.log(object);\n//=> {foo: {bar: 'b', baz: 'x', biz: ['a']}}\n\n// Has\nhasProperty({foo: {bar: 'unicorn'}}, 'foo.bar');\n//=> true\n\n// Deleter\nconst object = {foo: {bar: 'a'}};\ndeleteProperty(object, 'foo.bar');\nconsole.log(object);\n//=> {foo: {}}\n\nobject.foo.bar = {x: 'y', y: 'x'};\ndeleteProperty(object, 'foo.bar.x');\nconsole.log(object);\n//=> {foo: {bar: {y: 'x'}}}\n```\n\n## API\n\n### getProperty(object, path, defaultValue?)\n\nGet the value of the property at the given path.\n\nReturns the value if any.\n\n### setProperty(object, path, value)\n\nSet the property at the given path to the given value.\n\nReturns the object.\n\n### hasProperty(object, path)\n\nCheck whether the property at the given path exists.\n\nReturns a boolean.\n\n### deleteProperty(object, path)\n\nDelete the property at the given path.\n\nReturns a boolean of whether the property existed before being deleted.\n\n### escapePath(path)\n\nEscape special characters in a path. Useful for sanitizing user input.\n\n```js\nimport {getProperty, escapePath} from 'dot-prop';\n\nconst object = {\n\tfoo: {\n\t\tbar: '👸🏻 You found me Mario!',\n\t},\n\t'foo.bar' : '🍄 The princess is in another castle!',\n};\nconst escapedPath = escapePath('foo.bar');\n\nconsole.log(getProperty(object, escapedPath));\n//=> '🍄 The princess is in another castle!'\n```\n\n### deepKeys(object)\n\nReturns an array of every path. Non-empty plain objects and arrays are deeply recursed and are not themselves included.\n\nThis can be useful to help flatten an object for an API that only accepts key-value pairs or for a tagged template literal.\n\n```js\nimport {getProperty, deepKeys} from 'dot-prop';\n\nconst user = {\n\tname: {\n\t\tfirst: 'Richie',\n\t\tlast: 'Bendall',\n\t},\n\tactiveTasks: [],\n\tcurrentProject: null\n};\n\nfor (const property of deepKeys(user)) {\n\tconsole.log(`${property}: ${getProperty(user, property)}`);\n\t//=> name.first: Richie\n\t//=> name.last: Bendall\n\t//=> activeTasks: []\n\t//=> currentProject: null\n}\n```\n\nSparse arrays are supported. In general, [avoid using sparse arrays](https://github.com/sindresorhus/dot-prop/issues/109#issuecomment-1614819869).\n\n#### object\n\nType: `object | array`\n\nObject or array to get, set, or delete the `path` value.\n\nYou are allowed to pass in `undefined` as the object to the `get` and `has` functions.\n\n#### path\n\nType: `string`\n\nPath of the property in the object, using `.` to separate each nested key.\n\nUse `\\\\.` if you have a `.` in the key.\n\nThe following path components are invalid and results in `undefined` being returned: `__proto__`, `prototype`, `constructor`.\n\n#### value\n\nType: `unknown`\n\nValue to set at `path`.\n\n#### defaultValue\n\nType: `unknown`\n\nDefault value.\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/dot-prop\n","readmeFilename":"readme.md","_rev":"1-617325edb6785324bc10248111d9eff1"}