MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / dump

Method dump

scripts/i18n.js:55–75  ·  view source on GitHub ↗
(data, { extension, stripDescriptions })

Source from the content-addressed store, hash-verified

53 }
54
55 dump(data, { extension, stripDescriptions }) {
56 if (extension === '.json') {
57 if (stripDescriptions) {
58 data = Object.entries(data).reduce((res, [key, value]) => {
59 // eslint-disable-next-line no-unused-vars
60 const { description, ...stripped } = value;
61 res[key] = stripped;
62 return res;
63 }, {});
64 }
65 data = JSON.stringify(data, null, 2);
66 } else if (extension === '.yml') {
67 data = yaml.dump(data, { sortKeys: true });
68 } else {
69 throw 'Unknown extension name!';
70 }
71 return {
72 path: `${this.lang}/messages${extension}`,
73 data,
74 };
75 }
76}
77
78class Locales {

Callers 3

dumpMethod · 0.45
endStreamFunction · 0.45
pullTranslationsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected