{"_id":"@eslint/object-schema","_rev":"6-52caa88d7818be4cb52f81d1154bb1d3","name":"@eslint/object-schema","dist-tags":{"latest":"3.0.0"},"versions":{"2.1.3":{"name":"@eslint/object-schema","version":"2.1.3","keywords":["object","validation","schema","merge"],"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","_id":"@eslint/object-schema@2.1.3","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"nicholas+eslint@nczconsulting.com"}],"homepage":"https://github.com/eslint/rewrite#readme","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"dist":{"shasum":"e65ae80ee2927b4fd8c5c26b15ecacc2b2a6cc2a","tarball":"https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.3.tgz","fileCount":10,"integrity":"sha512-HAbhAYKfsAC2EkTqve00ibWIZlaU74Z1EHwAjYr4PXF0YU2VEA1zSIKSSpKszRLRWwHzzRZXvK632u+uXzvsvw==","signatures":[{"sig":"MEYCIQCu6KY8smR5L4QDCx9vPWjIgUafFB+awOTpVGxIYt61QgIhALVJpHPwK8J/SwGcCWDEm+lmFf3q/Fk8S5JuiYoYQLtp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52807},"type":"module","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0"},"exports":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"gitHead":"12012ffea9128c8c5cc035d3806a128308b26186","scripts":{"test":"mocha tests/","build":"rollup -c && tsc -p tsconfig.esm.json && npm run build:cts","test:jsr":"npx jsr@latest publish --dry-run","build:cts":"node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\""},"_npmUser":{"name":"eslintbot","email":"nicholas+eslint@nczconsulting.com"},"repository":{"url":"git+https://github.com/eslint/rewrite.git","type":"git"},"_npmVersion":"10.5.2","description":"An object schema merger/validator","directories":{"test":"tests"},"_nodeVersion":"20.13.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.4.0","rollup":"^4.16.2","typescript":"^5.4.5","rollup-plugin-copy":"^3.5.0"},"_npmOperationalInternal":{"tmp":"tmp/object-schema_2.1.3_1717101623079_0.8190393680536692","host":"s3://npm-registry-packages"}},"2.1.4":{"name":"@eslint/object-schema","version":"2.1.4","keywords":["object","validation","schema","merge"],"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","_id":"@eslint/object-schema@2.1.4","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"nicholas+eslint@nczconsulting.com"}],"homepage":"https://github.com/eslint/rewrite#readme","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"dist":{"shasum":"9e69f8bb4031e11df79e03db09f9dbbae1740843","tarball":"https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz","fileCount":10,"integrity":"sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==","signatures":[{"sig":"MEUCIEvN7PZafbjBuQghL/76RRRPeYJRdB6MAOlRRh6QPhg8AiEAgwf1Pz2DMSBIcyWcfAYXy7nk6Uy2HzkX9AFgsbuPEho=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55487},"main":"dist/esm/index.js","type":"module","types":"dist/esm/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0"},"exports":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"gitHead":"2a7bed41976f94495f7ba46f459f1de9d3305664","scripts":{"test":"mocha tests/","build":"rollup -c && tsc -p tsconfig.esm.json && npm run build:cts","test:jsr":"npx jsr@latest publish --dry-run","build:cts":"node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"","test:coverage":"c8 npm test"},"_npmUser":{"name":"eslintbot","email":"nicholas+eslint@nczconsulting.com"},"repository":{"url":"git+https://github.com/eslint/rewrite.git","type":"git"},"_npmVersion":"10.7.0","description":"An object schema merger/validator","directories":{"test":"tests"},"_nodeVersion":"20.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^9.1.0","mocha":"^10.4.0","rollup":"^4.16.2","typescript":"^5.4.5","rollup-plugin-copy":"^3.5.0"},"_npmOperationalInternal":{"tmp":"tmp/object-schema_2.1.4_1718202693724_0.9989908493722703","host":"s3://npm-registry-packages"}},"2.1.5":{"name":"@eslint/object-schema","version":"2.1.5","keywords":["object","validation","schema","merge"],"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","_id":"@eslint/object-schema@2.1.5","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"nicholas@eslint.org"}],"homepage":"https://github.com/eslint/rewrite#readme","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"dist":{"shasum":"8670a8f6258a2be5b2c620ff314a1d984c23eb2e","tarball":"https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz","fileCount":10,"integrity":"sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==","signatures":[{"sig":"MEYCIQC5vaJ//+9g4KTFu4l0uhU86QSPOSWEo6aP7yZ7dybUwwIhAJ2sUapPc+0JhYl0eBboUkjlRqGdr8XcjhTxYHGYnC96","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eslint%2fobject-schema@2.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":57040},"main":"dist/esm/index.js","type":"module","types":"dist/esm/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0"},"exports":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"gitHead":"dd8d161c635450f3e37109f833737bf69f54db55","scripts":{"test":"mocha tests/","build":"rollup -c && tsc -p tsconfig.esm.json && npm run build:cts","test:jsr":"npx jsr@latest publish --dry-run","build:cts":"node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"","test:coverage":"c8 npm test"},"_npmUser":{"name":"eslintbot","email":"nicholas@eslint.org"},"repository":{"url":"git+https://github.com/eslint/rewrite.git","type":"git"},"_npmVersion":"10.9.0","description":"An object schema merger/validator","directories":{"test":"tests"},"_nodeVersion":"22.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^9.1.0","mocha":"^10.4.0","rollup":"^4.16.2","typescript":"^5.4.5","rollup-plugin-copy":"^3.5.0"},"_npmOperationalInternal":{"tmp":"tmp/object-schema_2.1.5_1733347408751_0.3211997724344855","host":"s3://npm-registry-packages"}},"2.1.6":{"name":"@eslint/object-schema","version":"2.1.6","keywords":["object","validation","schema","merge"],"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","_id":"@eslint/object-schema@2.1.6","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"nicholas@eslint.org"}],"homepage":"https://github.com/eslint/rewrite#readme","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"dist":{"shasum":"58369ab5b5b3ca117880c0f6c0b0f32f6950f24f","tarball":"https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz","fileCount":10,"integrity":"sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==","signatures":[{"sig":"MEUCIQDDMEh/N3HSCxrAbPFSoR+5b4AiJV0i+ekupaMB70CpMAIgHUnHk9TpbvgxmZMl9XVz8UxJTBtVNLKTewhnONDeCCk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eslint%2fobject-schema@2.1.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56960},"main":"dist/esm/index.js","type":"module","types":"dist/esm/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0"},"exports":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"gitHead":"e1cb6037bc237313dbf3f6a7b9f5cd3c3105b668","scripts":{"test":"mocha tests/","build":"rollup -c && tsc -p tsconfig.esm.json && npm run build:cts","test:jsr":"npx jsr@latest publish --dry-run","build:cts":"node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts","test:coverage":"c8 npm test"},"_npmUser":{"name":"eslintbot","email":"nicholas@eslint.org"},"repository":{"url":"git+https://github.com/eslint/rewrite.git","type":"git"},"_npmVersion":"10.9.2","description":"An object schema merger/validator","directories":{"test":"tests"},"_nodeVersion":"22.13.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^9.1.0","mocha":"^10.4.0","rollup":"^4.16.2","typescript":"^5.4.5","rollup-plugin-copy":"^3.5.0"},"_npmOperationalInternal":{"tmp":"tmp/object-schema_2.1.6_1738344166529_0.8094857111733287","host":"s3://npm-registry-packages-npm-production"}},"2.1.7":{"name":"@eslint/object-schema","version":"2.1.7","keywords":["object","validation","schema","merge"],"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","_id":"@eslint/object-schema@2.1.7","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"contact@eslint.org"}],"homepage":"https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"dist":{"shasum":"6e2126a1347e86a4dedf8706ec67ff8e107ebbad","tarball":"https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz","fileCount":10,"integrity":"sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==","signatures":[{"sig":"MEUCIQC9MSGz+rqqcZ8Jt+X0YYTypFSsIpolxO0taVnB0EFATgIgPgovImvpv96OpkgdFv32NaptCh02BEXFNuuLu01yzBg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eslint%2fobject-schema@2.1.7","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":57521},"main":"dist/esm/index.js","type":"module","types":"dist/esm/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0"},"exports":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"gitHead":"df12d9a67c9fdf7959ae79bd2f49462656d474f5","scripts":{"test":"mocha \"tests/**/*.test.js\"","build":"rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts","test:jsr":"npx jsr@latest publish --dry-run","build:cts":"node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts","test:types":"tsc -p tests/types/tsconfig.json","test:coverage":"c8 npm test","build:dedupe-types":"node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1295a891-c6bd-4729-9ef7-41e7903845dc"}},"repository":{"url":"git+https://github.com/eslint/rewrite.git","type":"git","directory":"packages/object-schema"},"_npmVersion":"11.6.2","description":"An object schema merger/validator","directories":{"test":"tests"},"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rollup-plugin-copy":"^3.5.0"},"_npmOperationalInternal":{"tmp":"tmp/object-schema_2.1.7_1760723892437_0.43865086000504117","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@eslint/object-schema","version":"3.0.0","description":"An object schema merger/validator","type":"module","main":"dist/esm/index.js","types":"dist/esm/index.d.ts","exports":{"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"},"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"}},"publishConfig":{"access":"public"},"directories":{"test":"tests"},"scripts":{"build:dedupe-types":"node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js","build:cts":"node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts","build":"rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts","test":"mocha \"tests/**/*.test.js\"","test:coverage":"c8 npm test","test:jsr":"npx jsr@latest publish --dry-run","test:types":"tsc -p tests/types/tsconfig.json"},"repository":{"type":"git","url":"git+https://github.com/eslint/rewrite.git","directory":"packages/object-schema"},"keywords":["object","validation","schema","merge"],"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"homepage":"https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme","devDependencies":{"rollup-plugin-copy":"^3.5.0"},"engines":{"node":"^20.19.0 || ^22.13.0 || >=24"},"gitHead":"c368656dbba4d927344905f24b3993a378a59a88","_id":"@eslint/object-schema@3.0.0","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-nWl20RtHQP2A2yvKU6Fee62Xo1AoNRqBLixtyg45zJhU8ljPFCyBK90d8e8XTnPns1RggSf4HH3bM8AhevkPVg==","shasum":"0efb4cf93d529ef7f4f66d3f8490e3bfcf1550f4","tarball":"https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.0.tgz","fileCount":10,"unpackedSize":57413,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eslint%2fobject-schema@3.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHhLx8NwCkiLLL1Ywui1CS8a+/vYlMMci66IbCthD1ZyAiAmdRW88FCcso5e/vf5hn6C6UivRlQSJVYmCus43Mh+Jg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1295a891-c6bd-4729-9ef7-41e7903845dc"}},"maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"contact@eslint.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/object-schema_3.0.0_1763137814842_0.1594137400573059"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-30T20:40:22.953Z","modified":"2025-11-14T16:30:15.550Z","2.1.3":"2024-05-30T20:40:23.310Z","2.1.4":"2024-06-12T14:31:33.901Z","2.1.5":"2024-12-04T21:23:28.907Z","2.1.6":"2025-01-31T17:22:46.772Z","2.1.7":"2025-10-17T17:58:12.617Z","3.0.0":"2025-11-14T16:30:15.065Z"},"bugs":{"url":"https://github.com/eslint/rewrite/issues"},"author":{"name":"Nicholas C. Zakas"},"license":"Apache-2.0","homepage":"https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme","keywords":["object","validation","schema","merge"],"repository":{"type":"git","url":"git+https://github.com/eslint/rewrite.git","directory":"packages/object-schema"},"description":"An object schema merger/validator","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"contact@eslint.org"}],"readme":"# ObjectSchema Package\n\n## Overview\n\nA JavaScript object merge/validation utility where you can define a different merge and validation strategy for each key. This is helpful when you need to validate complex data structures and then merge them in a way that is more complex than `Object.assign()`. This is used in the [`@eslint/config-array`](https://npmjs.com/package/@eslint/config-array) package but can also be used on its own.\n\n## Installation\n\nFor Node.js and compatible runtimes:\n\n```shell\nnpm install @eslint/object-schema\n# or\nyarn add @eslint/object-schema\n# or\npnpm install @eslint/object-schema\n# or\nbun add @eslint/object-schema\n```\n\nFor Deno:\n\n```shell\ndeno add @eslint/object-schema\n```\n\n## Usage\n\nImport the `ObjectSchema` constructor:\n\n```js\n// using ESM\nimport { ObjectSchema } from \"@eslint/object-schema\";\n\n// using CommonJS\nconst { ObjectSchema } = require(\"@eslint/object-schema\");\n\nconst schema = new ObjectSchema({\n\t// define a definition for the \"downloads\" key\n\tdownloads: {\n\t\trequired: true,\n\t\tmerge(value1, value2) {\n\t\t\treturn value1 + value2;\n\t\t},\n\t\tvalidate(value) {\n\t\t\tif (typeof value !== \"number\") {\n\t\t\t\tthrow new Error(\"Expected downloads to be a number.\");\n\t\t\t}\n\t\t},\n\t},\n\n\t// define a strategy for the \"versions\" key\n\tversion: {\n\t\trequired: true,\n\t\tmerge(value1, value2) {\n\t\t\treturn value1.concat(value2);\n\t\t},\n\t\tvalidate(value) {\n\t\t\tif (!Array.isArray(value)) {\n\t\t\t\tthrow new Error(\"Expected versions to be an array.\");\n\t\t\t}\n\t\t},\n\t},\n});\n\nconst record1 = {\n\tdownloads: 25,\n\tversions: [\"v1.0.0\", \"v1.1.0\", \"v1.2.0\"],\n};\n\nconst record2 = {\n\tdownloads: 125,\n\tversions: [\"v2.0.0\", \"v2.1.0\", \"v3.0.0\"],\n};\n\n// make sure the records are valid\nschema.validate(record1);\nschema.validate(record2);\n\n// merge together (schema.merge() accepts any number of objects)\nconst result = schema.merge(record1, record2);\n\n// result looks like this:\n\nconst result = {\n\tdownloads: 75,\n\tversions: [\"v1.0.0\", \"v1.1.0\", \"v1.2.0\", \"v2.0.0\", \"v2.1.0\", \"v3.0.0\"],\n};\n```\n\n## Tips and Tricks\n\n### Named merge strategies\n\nInstead of specifying a `merge()` method, you can specify one of the following strings to use a default merge strategy:\n\n- `\"assign\"` - use `Object.assign()` to merge the two values into one object.\n- `\"overwrite\"` - the second value always replaces the first.\n- `\"replace\"` - the second value replaces the first if the second is not `undefined`.\n\nFor example:\n\n```js\nconst schema = new ObjectSchema({\n\tname: {\n\t\tmerge: \"replace\",\n\t\tvalidate() {},\n\t},\n});\n```\n\n### Named validation strategies\n\nInstead of specifying a `validate()` method, you can specify one of the following strings to use a default validation strategy:\n\n- `\"array\"` - value must be an array.\n- `\"boolean\"` - value must be a boolean.\n- `\"number\"` - value must be a number.\n- `\"object\"` - value must be an object.\n- `\"object?\"` - value must be an object or null.\n- `\"string\"` - value must be a string.\n- `\"string!\"` - value must be a non-empty string.\n\nFor example:\n\n```js\nconst schema = new ObjectSchema({\n\tname: {\n\t\tmerge: \"replace\",\n\t\tvalidate: \"string\",\n\t},\n});\n```\n\n### Subschemas\n\nIf you are defining a key that is, itself, an object, you can simplify the process by using a subschema. Instead of defining `merge()` and `validate()`, assign a `schema` key that contains a schema definition, like this:\n\n```js\nconst schema = new ObjectSchema({\n\tname: {\n\t\tschema: {\n\t\t\tfirst: {\n\t\t\t\tmerge: \"replace\",\n\t\t\t\tvalidate: \"string\",\n\t\t\t},\n\t\t\tlast: {\n\t\t\t\tmerge: \"replace\",\n\t\t\t\tvalidate: \"string\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nschema.validate({\n\tname: {\n\t\tfirst: \"n\",\n\t\tlast: \"z\",\n\t},\n});\n```\n\n### Remove Keys During Merge\n\nIf the merge strategy for a key returns `undefined`, then the key will not appear in the final object. For example:\n\n```js\nconst schema = new ObjectSchema({\n\tdate: {\n\t\tmerge() {\n\t\t\treturn undefined;\n\t\t},\n\t\tvalidate(value) {\n\t\t\tDate.parse(value); // throws an error when invalid\n\t\t},\n\t},\n});\n\nconst object1 = { date: \"5/5/2005\" };\nconst object2 = { date: \"6/6/2006\" };\n\nconst result = schema.merge(object1, object2);\n\nconsole.log(\"date\" in result); // false\n```\n\n### Requiring Another Key Be Present\n\nIf you'd like the presence of one key to require the presence of another key, you can use the `requires` property to specify an array of other properties that any key requires. For example:\n\n```js\nconst schema = new ObjectSchema();\n\nconst schema = new ObjectSchema({\n\tdate: {\n\t\tmerge() {\n\t\t\treturn undefined;\n\t\t},\n\t\tvalidate(value) {\n\t\t\tDate.parse(value); // throws an error when invalid\n\t\t},\n\t},\n\ttime: {\n\t\trequires: [\"date\"],\n\t\tmerge(first, second) {\n\t\t\treturn second;\n\t\t},\n\t\tvalidate(value) {\n\t\t\t// ...\n\t\t},\n\t},\n});\n\n// throws error: Key \"time\" requires keys \"date\"\nschema.validate({\n\ttime: \"13:45\",\n});\n```\n\nIn this example, even though `date` is an optional key, it is required to be present whenever `time` is present.\n\n## License\n\nApache 2.0\n\n<!-- NOTE: This section is autogenerated. Do not manually edit.-->\n<!--sponsorsstart-->\n\n## Sponsors\n\nThe following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)\nto get your logo on our READMEs and [website](https://eslint.org/sponsors).\n\n<h3>Platinum Sponsors</h3>\n<p><a href=\"https://automattic.com\"><img src=\"https://images.opencollective.com/automattic/d0ef3e1/logo.png\" alt=\"Automattic\" height=\"128\"></a> <a href=\"https://www.airbnb.com/\"><img src=\"https://images.opencollective.com/airbnb/d327d66/logo.png\" alt=\"Airbnb\" height=\"128\"></a></p><h3>Gold Sponsors</h3>\n<p><a href=\"https://qlty.sh/\"><img src=\"https://images.opencollective.com/qltysh/33d157d/logo.png\" alt=\"Qlty Software\" height=\"96\"></a> <a href=\"https://shopify.engineering/\"><img src=\"https://avatars.githubusercontent.com/u/8085\" alt=\"Shopify\" height=\"96\"></a></p><h3>Silver Sponsors</h3>\n<p><a href=\"https://vite.dev/\"><img src=\"https://images.opencollective.com/vite/e6d15e1/logo.png\" alt=\"Vite\" height=\"64\"></a> <a href=\"https://liftoff.io/\"><img src=\"https://images.opencollective.com/liftoff/2d6c3b6/logo.png\" alt=\"Liftoff\" height=\"64\"></a> <a href=\"https://americanexpress.io\"><img src=\"https://avatars.githubusercontent.com/u/3853301\" alt=\"American Express\" height=\"64\"></a> <a href=\"https://stackblitz.com\"><img src=\"https://avatars.githubusercontent.com/u/28635252\" alt=\"StackBlitz\" height=\"64\"></a></p><h3>Bronze Sponsors</h3>\n<p><a href=\"https://cybozu.co.jp/\"><img src=\"https://images.opencollective.com/cybozu/933e46d/logo.png\" alt=\"Cybozu\" height=\"32\"></a> <a href=\"https://syntax.fm\"><img src=\"https://github.com/syntaxfm.png\" alt=\"Syntax\" height=\"32\"></a> <a href=\"https://icons8.com/\"><img src=\"https://images.opencollective.com/icons8/7fa1641/logo.png\" alt=\"Icons8\" height=\"32\"></a> <a href=\"https://discord.com\"><img src=\"https://images.opencollective.com/discordapp/f9645d9/logo.png\" alt=\"Discord\" height=\"32\"></a> <a href=\"https://www.gitbook.com\"><img src=\"https://avatars.githubusercontent.com/u/7111340\" alt=\"GitBook\" height=\"32\"></a> <a href=\"https://nx.dev\"><img src=\"https://avatars.githubusercontent.com/u/23692104\" alt=\"Nx\" height=\"32\"></a> <a href=\"https://opensource.mercedes-benz.com/\"><img src=\"https://avatars.githubusercontent.com/u/34240465\" alt=\"Mercedes-Benz Group\" height=\"32\"></a> <a href=\"https://herocoders.com\"><img src=\"https://avatars.githubusercontent.com/u/37549774\" alt=\"HeroCoders\" height=\"32\"></a> <a href=\"https://www.lambdatest.com\"><img src=\"https://avatars.githubusercontent.com/u/171592363\" alt=\"LambdaTest\" height=\"32\"></a></p>\n<h3>Technology Sponsors</h3>\nTechnology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.\n<p><a href=\"https://netlify.com\"><img src=\"https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg\" alt=\"Netlify\" height=\"32\"></a> <a href=\"https://algolia.com\"><img src=\"https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg\" alt=\"Algolia\" height=\"32\"></a> <a href=\"https://1password.com\"><img src=\"https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg\" alt=\"1Password\" height=\"32\"></a></p>\n<!--sponsorsend-->\n","readmeFilename":"README.md"}