Skip to content

Commit

Permalink
KeyValues.toObject support base list merging
Browse files Browse the repository at this point in the history
  • Loading branch information
robincodex committed Dec 3, 2024
1 parent b3d4c74 commit 23f8c88
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 486 deletions.
4 changes: 4 additions & 0 deletions __tests__/KeyValues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ describe('KeyValues', () => {
expect(typeof obj2['Ha']['t1']['ggg']).toBe('object');
expect(typeof obj2['test']).toBe('object');

const kv3 = await KeyValues.Load(join(__dirname, 'KeyValues.base.txt'));
const obj3 = kv3.toObject();
expect(obj3).toMatchSnapshot();

try {
new KeyValues('a', '123').toObject();
} catch (e) {
Expand Down
15 changes: 15 additions & 0 deletions __tests__/__snapshots__/KeyValues.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

exports[`KeyValues Check KeyValues #base 1`] = `"#base "npc/file01.txt" // file01"`;

exports[`KeyValues Check KeyValues.toObject 1`] = `
{
"DOTAAbilities": {
"ability01": {
"AbilityBehavior": "DOTA_ABILITY_BEHAVIOR_POINT",
"BaseClass": "ability_lua",
},
"ability02": {
"AbilityBehavior": "DOTA_ABILITY_BEHAVIOR_POINT",
"BaseClass": "ability_datadriven",
},
},
}
`;

exports[`KeyValues Check KeyValues.txt 1`] = `
""DOTAAbilities"
{
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@
"license": "MIT",
"devDependencies": {
"@jest/globals": "^29.7.0",
"@rollup/plugin-commonjs": "26.0.1",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-typescript": "11.1.6",
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.7",
"@types/node": "^22.5.4",
"@rollup/plugin-commonjs": "28.0.1",
"@rollup/plugin-node-resolve": "15.3.0",
"@rollup/plugin-typescript": "12.1.1",
"@types/jest": "^29.5.14",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.1",
"iconv-lite": "^0.6.3",
"jest": "^29.7.0",
"jest-coverage-badges": "^1.1.2",
"prettier": "^3.3.3",
"rollup": "4.21.2",
"prettier": "^3.4.1",
"rollup": "4.28.0",
"rollup-plugin-dts": "^6.1.1",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tslib": "^2.7.0",
"typescript": "5.5.4"
"tslib": "^2.8.1",
"typescript": "5.7.2"
}
}
Loading

0 comments on commit 23f8c88

Please sign in to comment.