Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lokse/core

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lokse/core - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

6

lib/line.d.ts

@@ -7,5 +7,5 @@ declare class Line {

constructor(key: string | null, value: string | null);
static checkIsComment(val: any): boolean;
static checkIsPlural: (val: any) => boolean;
static parseKeysFromPlural: (val: string) => string[];
static checkIsComment(val: string): boolean;
static checkIsPlural: (val: string) => boolean;
static parseKeysFromPlural: (val: string) => [string, string];
static normalizeComment(val: string): string;

@@ -12,0 +12,0 @@ isEmpty(): boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable unicorn/filename-case */
const COMMENT_STARTERS = ["//", "#"];
const PLURAL_KEY_RE = /.+##\{(zero|one|two|few|many|other)\}/;
const PLURAL_POSTFIX_RE = /##\{(zero|one|two|few|many|other)\}/;
const PLURAL_KEY_RE = /.+##{(zero|one|two|few|many|other)}/;
const PLURAL_POSTFIX_RE = /##{(zero|one|two|few|many|other)}/;
var Type;

@@ -52,3 +51,3 @@ (function (Type) {

if (index === 0) {
const normalized = val.substr(commentStarter.length, val.length - commentStarter.length);
const normalized = val.slice(commentStarter.length);
return normalized.trim();

@@ -83,3 +82,3 @@ }

Line.checkIsPlural = function (val) {
if (val.match(PLURAL_KEY_RE)) {
if (PLURAL_KEY_RE.test(val)) {
return true;

@@ -86,0 +85,0 @@ }

@@ -34,6 +34,2 @@ import type { GoogleSpreadsheetRow } from "google-spreadsheet";

export declare type PluginFactory = (options: GeneralPluginOptions, meta: GeneralPluginMeta) => LoksePlugin;
export declare function createPlugin(plugin: Partial<LoksePlugin>): {
transformLine: (line: Line, meta: TransformLineMeta) => Line | Promise<Line>;
transformFullOutput: (output: string, meta: TransformFullOutputMeta) => string | Promise<string>;
readTranslation: (line: Line, meta: ReadTranslationMeta) => Line | Promise<Line>;
};
export declare function createPlugin(plugin: Partial<LoksePlugin>): LoksePlugin;

@@ -8,4 +8,4 @@ import type { GeneralPluginOptions, GeneralPluginMeta } from "./create";

name: PluginName;
options: object;
options: Record<string, any>;
}
export declare function loadPlugins(plugins: unknown, options: GeneralPluginOptions, meta: GeneralPluginMeta): PluginsRunner;
export declare function loadPlugins(plugins: (PluginName | PluginDefinition)[] | unknown, options: GeneralPluginOptions, meta: GeneralPluginMeta): PluginsRunner;

@@ -33,3 +33,3 @@ "use strict";

}
function loadPlugins(plugins = [], options, meta) {
function loadPlugins(plugins, options, meta) {
let loadedPlugins;

@@ -36,0 +36,0 @@ if (Array.isArray(plugins)) {

@@ -19,4 +19,6 @@ "use strict";

await this.spreadsheet.useServiceAccountAuth({
// eslint-disable-next-line camelcase
client_email: LOKSE_SERVICE_ACCOUNT_EMAIL,
// Treat new lines properly - https://stackoverflow.com/a/36439803/7051731
// eslint-disable-next-line camelcase
private_key: LOKSE_PRIVATE_KEY.replace(/\\n/g, "\n"),

@@ -48,13 +50,13 @@ });

const plugins = this.plugins;
const worksheetsLines = await worksheets.reduce(async (worksheetLinesPromise, worksheet) => {
const worksheetLines = await worksheetLinesPromise;
const worksheetsLines = {};
const processWorksheetsPromises = worksheets.map(async (worksheet) => {
const { title } = worksheet;
try {
const lines = await worksheet.extractLines(keyColumn, valueColumn, plugins);
if (worksheetLines[title]) {
if (worksheetsLines[title]) {
this.logger.warn(`🔀 Found two sheets with same title ${title}. We're gonna concat the data.`);
worksheetLines[title] = worksheetLines[title].concat(lines);
worksheetsLines[title] = [...worksheetsLines[title], ...lines];
}
else {
worksheetLines[title] = lines;
worksheetsLines[title] = lines;
}

@@ -65,4 +67,4 @@ }

}
return worksheetLines;
}, Promise.resolve({}));
});
await Promise.all(processWorksheetsPromises);
return worksheetsLines;

@@ -69,0 +71,0 @@ }

@@ -6,3 +6,3 @@ import type { GoogleSpreadsheet, GoogleSpreadsheetWorksheet } from "google-spreadsheet";

filterStringified: string;
constructor(filter: any);
constructor(filter: unknown);
}

@@ -9,0 +9,0 @@ declare type SheetTitle = string;

@@ -84,3 +84,3 @@ "use strict";

}
const sheets = await bluebird_1.all(worksheets.map(this.loadSheet));
const sheets = await bluebird_1.all(worksheets.map((worksheet) => this.loadSheet(worksheet)));
return sheets;

@@ -87,0 +87,0 @@ }

@@ -8,3 +8,3 @@ "use strict";

return str;
return str.substr(0, index) + chr + str.substr(index + 1);
return str.slice(0, index) + chr + str.slice(index + 1);
}

@@ -19,3 +19,3 @@ const androidTransformer = {

normalizedValue = normalizedValue.replace(/'/gi, "\\'");
normalizedValue = normalizedValue.replace(/%([sdf])/gi, "%#$$$1");
normalizedValue = normalizedValue.replace(/%([dfs])/gi, "%#$$$1");
normalizedValue = normalizedValue.replace(/&/gi, "&amp;");

@@ -36,6 +36,6 @@ normalizedValue = normalizedValue.replace(/\u00A0/gi, "\\u00A0");

let ouput = ' <plurals name="' + key + '">' + os_1.EOL;
for (let i = 0; i < values.length; i++) {
let normalizedValue = values[i].value.replace(/%newline%/gi, "\\n");
for (const value of values) {
let normalizedValue = value.value.replace(/%newline%/gi, "\\n");
normalizedValue = normalizedValue.replace(/'/gi, "\\'");
normalizedValue = normalizedValue.replace(/%([sdf])/gi, "%#$$$1");
normalizedValue = normalizedValue.replace(/%([dfs])/gi, "%#$$$1");
normalizedValue = normalizedValue.replace(/&/gi, "&amp;");

@@ -46,3 +46,3 @@ normalizedValue = normalizedValue.replace(/\u00A0/gi, "\\u00A0");

' <item quantity="' +
values[i].getPluralKey() +
value.getPluralKey() +
'">' +

@@ -77,8 +77,3 @@ normalizedValue +

const autoGeneratedIndex = input.indexOf(AUTOGENERATED_TAG);
if (autoGeneratedIndex >= 0) {
output = input.substr(0, autoGeneratedIndex);
}
else {
output = input.substr(0, closeTagIndex);
}
output = input.slice(0, autoGeneratedIndex >= 0 ? autoGeneratedIndex : closeTagIndex);
}

@@ -85,0 +80,0 @@ output += AUTOGENERATED_TAG + os_1.EOL + newValues + os_1.EOL + "</resources>";

@@ -24,3 +24,3 @@ "use strict";

if (generatedIndex >= 0) {
input = input.substr(0, generatedIndex);
input = input.slice(0, generatedIndex);
}

@@ -27,0 +27,0 @@ const output = input + iOSTransformer.AUTOGENERATED_TAG + os_1.EOL + newValues;

@@ -20,3 +20,3 @@ "use strict";

async insert(_, newValues) {
newValues = newValues.substring(0, newValues.length - 1);
newValues = newValues.slice(0, -1);
return `${os_1.EOL}{${os_1.EOL}${newValues}${os_1.EOL}}`;

@@ -23,0 +23,0 @@ },

{
"name": "@lokse/core",
"description": "Core of localization from spreadsheet solution lokse",
"version": "2.1.3",
"version": "2.1.4",
"author": {

@@ -40,3 +40,3 @@ "name": "Lukas Horak",

},
"gitHead": "6f9fe55995adc8ddfba8cd4adbb387ae4633a316"
"gitHead": "503e39ba324130047e1341aa652b125a4272d9b7"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc