(bugfix) order of keys was not preserved when using namespaced-json format. Closes #131

This commit is contained in:
Kim Biesbjerg 2019-08-02 13:34:18 +02:00
parent 3cbc20e0a0
commit a5b8f6e6c6
3 changed files with 13 additions and 5 deletions

7
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@biesbjerg/ngx-translate-extract",
"version": "2.3.4",
"version": "3.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -512,9 +512,8 @@
}
},
"flat": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz",
"integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==",
"version": "git://github.com/lenchvolodymyr/flat.git#ffe77efe8c33bc80ffb2f7a465537610dea4f611",
"from": "git://github.com/lenchvolodymyr/flat.git#ffe77ef",
"requires": {
"is-buffer": "~2.0.3"
}

View File

@ -60,7 +60,7 @@
"@angular/compiler": "^8.1.3",
"boxen": "^4.1.0",
"colorette": "^1.1.0",
"flat": "^4.1.0",
"flat": "git://github.com/lenchvolodymyr/flat.git#ffe77ef",
"gettext-parser": "^4.0.1",
"glob": "^7.1.4",
"mkdirp": "^0.5.1",

View File

@ -57,4 +57,13 @@ describe('NamespacedJsonCompiler', () => {
expect(result).to.equal('{\n "NAMESPACE": {\n "KEY": {\n "FIRST_KEY": "",\n "SECOND_KEY": "VALUE"\n }\n }\n}');
});
it('should not reorder keys when compiled', () => {
const collection = new TranslationCollection({
'BROWSE': '',
'LOGIN': ''
});
const result: string = compiler.compile(collection);
expect(result).to.equal('{\n\t"BROWSE": "",\n\t"LOGIN": ""\n}');
});
});