{"_id":"@bybrave/object-path2","name":"@bybrave/object-path2","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bybrave/object-path2","version":"1.0.0","description":"Maintained fork of object-path — access/set deep object properties by path, now dual ESM+CJS, 0 dependencies, with built-in TypeScript types","main":"lib/object-path.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.mjs","require":"./lib/object-path.js"},"./package.json":"./package.json"},"scripts":{"test":"node --test test/*.test.js","test:compat":"mocha test/compat.js","test-types":"tsc --noEmit --strict test/type-declarations.ts"},"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/object-path2.git"},"bugs":{"url":"https://github.com/bybraveHQ/object-path2/issues"},"homepage":"https://github.com/bybraveHQ/object-path2#readme","keywords":["object","path","deep","access","get","set","property","dot","notation","nested","value","key","typescript","esm"],"author":{"name":"bybrave","url":"https://github.com/bybraveHQ"},"contributors":[{"name":"Mario Casciaro","url":"author of the original object-path"}],"license":"MIT","funding":"https://ko-fi.com/bybrave","engines":{"node":">=18"},"devDependencies":{"@types/node":"^20.14.0","chai":"^4.3.4","mocha":"^9.1.0","typescript":"^5.5.0"},"_id":"@bybrave/object-path2@1.0.0","gitHead":"b3c2fb37d9d6d703f3dbc06a24e15d9ffd566194","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-/HzgEZmASvbO62L6Td16fktKDt9KVn/DZ5Vd6r/Y0ajDUbZP8OsMVHzKWDy8sbymAzrEzQ/0UpkqLM1cvEjZ4Q==","shasum":"c1b97d0d95c24b9e191657354a050ce71d37d625","tarball":"https://registry.npmjs.org/@bybrave/object-path2/-/object-path2-1.0.0.tgz","fileCount":6,"unpackedSize":18291,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHtk1yWGD8GcA97OZcIpmyb3rFSVN/QFo5zbGDbnq/D8AiEAgrxenCziVHNu/BWIAuanP6EjHYqGVvVsHkg6BB9b/ek="}]},"_npmUser":{"name":"bybrave","email":"opmybrave@gmail.com"},"directories":{},"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/object-path2_1.0.0_1783382739300_0.4648007761437385"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-07T00:05:39.115Z","1.0.0":"2026-07-07T00:05:39.448Z","modified":"2026-07-07T00:05:39.670Z"},"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"description":"Maintained fork of object-path — access/set deep object properties by path, now dual ESM+CJS, 0 dependencies, with built-in TypeScript types","homepage":"https://github.com/bybraveHQ/object-path2#readme","keywords":["object","path","deep","access","get","set","property","dot","notation","nested","value","key","typescript","esm"],"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/object-path2.git"},"contributors":[{"name":"Mario Casciaro","url":"author of the original object-path"}],"author":{"name":"bybrave","url":"https://github.com/bybraveHQ"},"bugs":{"url":"https://github.com/bybraveHQ/object-path2/issues"},"license":"MIT","readme":"# @bybrave/object-path2\n\nMaintained, drop-in fork of [`object-path`](https://github.com/mariocasciaro/object-path) — access and set deep object properties by a string/array path (`get`, `set`, `has`, `del`, `push`, `insert`, `empty`, `coalesce`, `ensureExists`).\n\nThe original has been unmaintained since 2023 (last release `0.11.8`), ships **no ESM build**, and has **no bundled TypeScript types**. This fork keeps the exact same API and behavior, byte-for-byte compatible with the original test suite, and adds what modern projects need.\n\n```bash\nnpm install @bybrave/object-path2\n```\n\n## Why this fork\n\n| Improvement | Detail |\n|---|---|\n| **Dual ESM + CJS** | Native `import` and `require` from a single package via the `exports` map — no more `ERR_REQUIRE_ESM` / bundler workarounds |\n| **Built-in TypeScript types** | `index.d.ts` bundled — you no longer need a separate `@types/object-path` install |\n| **Zero dependencies** | No runtime deps, nothing transitive to audit |\n| **Bug fix — `set` through a `null` node** ([#97](https://github.com/mariocasciaro/object-path/issues/97) / [#94](https://github.com/mariocasciaro/object-path/pull/94)) | `set({a: null}, 'a.b', 'c')` now rebuilds the container instead of throwing `Cannot set property 'b' of null` |\n| **Modern tooling** | Node 18/20/22 CI, tests on `node:test`, prototype-pollution protection covered by an explicit CVE test |\n\nPrototype-pollution protection (`__proto__` / `prototype` / `constructor`) from upstream is preserved and covered by tests.\n\n## Compatibility\n\n100% API-compatible with `object-path@0.11.8`. The fork passes the **original upstream test suite unchanged** (`test/compat.js`) plus its own tests. The only behavioral change is the `set`-through-`null` fix above, which lives in a case the original left as an unhandled throw.\n\n## Migration\n\nDrop-in — just change the import specifier:\n\n```diff\n- const objectPath = require('object-path');\n+ const objectPath = require('@bybrave/object-path2');\n```\n\n```ts\n// ESM + TypeScript (types are bundled)\nimport objectPath, { get, set } from '@bybrave/object-path2';\n```\n\nYou can remove `@types/object-path` from your `devDependencies`.\n\n## Usage\n\n```js\nimport objectPath from '@bybrave/object-path2';\n\nconst obj = { a: { b: { c: 1 } }, list: [1, 2, 3] };\n\nobjectPath.get(obj, 'a.b.c');            // => 1\nobjectPath.get(obj, 'a.b.x', 'default'); // => 'default'\nobjectPath.set(obj, 'a.b.d', 2);         // sets obj.a.b.d = 2\nobjectPath.has(obj, 'a.b.c');            // => true\nobjectPath.push(obj, 'list', 4);         // list => [1,2,3,4]\nobjectPath.del(obj, 'a.b.c');            // removes obj.a.b.c\n\n// bound mode — object is pre-bound\nconst op = objectPath(obj);\nop.get('a.b.d');                         // => 2\n\n// inherited-props / security variants\nobjectPath.withInheritedProps.get(obj, 'a.b.c');\nconst custom = objectPath.create({ includeInheritedProps: true });\n```\n\nAll methods accept the path as a dotted string (`'a.b.c'`), a number, or an array of segments (`['a', 'b', 'c']`).\n\n## Support\n\nIf this package saves you time, you can support maintenance:\n\n[![Ko-fi](https://img.shields.io/badge/Ko--fi-buy%20me%20a%20coffee-FF5E5B?logo=kofi&logoColor=white)](https://ko-fi.com/bybrave)\n[![Bitcoin](https://img.shields.io/badge/Bitcoin-BTC-F7931A?logo=bitcoin&logoColor=white)](#support)\n\nBitcoin (BTC): `bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q`\n\n## License\n\nMIT © 2015 Mario Casciaro (original `object-path`), © 2026 bybrave (fork). See [LICENSE](./LICENSE).\n","readmeFilename":"README.md","_rev":"1-0846f9ec8ee5340098a600cf345cb9b9"}