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

bobril-g11n

Package Overview
Dependencies
Maintainers
0
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bobril-g11n - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

dist/index.html

4

CHANGELOG.md
# CHANGELOG
## 5.1.2
Slightly improved performance of `RuntimeFunctionGenerator` function.
## 5.1.1

@@ -4,0 +8,0 @@

4

package.json
{
"name": "bobril-g11n",
"version": "5.1.1",
"version": "5.1.2",
"description": "Bobril globalization",

@@ -40,2 +40,2 @@ "main": "index.js",

"license": "MIT"
}
}

@@ -263,3 +263,3 @@ import * as moment from "moment";

} else {
comp.addBody(comp.addConstant(compile(locale, item)) + `(${argParams},${argHash})`);
comp.addBody(comp.addConstant(compile(locale, item)), `(${argParams},${argHash})`);
}

@@ -294,3 +294,3 @@ }

} else {
comp.addBody(comp.addConstant(compile(locale, item)) + `(${argParams},${argHash})`);
comp.addBody(comp.addConstant(compile(locale, item)), `(${argParams},${argHash})`);
}

@@ -305,4 +305,4 @@ }

(id: number, valueFactory: (params?: Object, hashArg?: string) => any) =>
(params?: Object, hashArg?: string) =>
(<any>params)[id](valueFactory(params, hashArg))
(params?: Object, hashArg?: string) =>
(<any>params)[id](valueFactory(params, hashArg))
)(msgAst.id, compile(locale, msgAst.value));

@@ -309,0 +309,0 @@ }

export class RuntimeFunctionGenerator {
constants: any[] = [];
body: string = '';
body: string[] = [];
argCount: number = 0;

@@ -10,16 +10,16 @@ localCount: number = 0;

for (let i = 0; i < cc.length; i++) {
if (cc[i] === value) return 'c_' + i;
if (cc[i] === value) return "c_" + i;
}
cc.push(value);
return 'c_' + (cc.length - 1);
return "c_" + (cc.length - 1);
}
addArg(index: number): string {
if (index >= this.argCount) this.argCount = index + 1;
return 'a_' + index;
return "a_" + index;
}
addBody(text: string): void {
this.body += text;
addBody(...texts: string[]): void {
([] as string[]).push.apply(this.body, texts);
}
addLocal(): string {
return 'l_' + (this.localCount++);
return "l_" + this.localCount++;
}

@@ -29,3 +29,3 @@ build(): Function {

for (let i = 0; i < this.argCount; i++) {
innerParams.push('a_' + i);
innerParams.push("a_" + i);
}

@@ -35,10 +35,12 @@ if (this.constants.length > 0) {

for (let i = 0; i < this.constants.length; i++) {
params.push('c_' + i);
params.push("c_" + i);
}
params.push('return function(' + innerParams.join(',') + ') {\n' + this.body + '\n}');
this.body.unshift("return function(", innerParams.join(","), ") {\n");
this.body.push("\n}");
params.push(this.body.join(""));
return Function.apply(null, params).apply(null, this.constants);
}
innerParams.push(this.body);
innerParams.push(this.body.join(""));
return Function.apply(null, innerParams);
}
}
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