We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9dbf579 commit f3b5944Copy full SHA for f3b5944
scripts/utils.js
@@ -3,7 +3,7 @@ import nodePath from 'node:path';
3
4
export function assign(obj = {}, lang = '', key = '', value = '') {
5
// Only add key if value exists
6
- if (!value || value.startsWith('//')) return;
+ if (!value) return;
7
obj[lang] ??= {}; // Does lang exist?
8
obj[lang][key] = value;
9
}
@@ -13,6 +13,15 @@ export async function readJSON(file) {
13
return JSON.parse(content);
14
15
16
+export async function fileExists(path) {
17
+ try {
18
+ await fs.access(path);
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+}
24
+
25
export function writeFile(path, data) {
26
return fs.writeFile(path, data);
27
0 commit comments