mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
36 lines
2.1 KiB
TypeScript
36 lines
2.1 KiB
TypeScript
import * as ESTree from "estree";
|
|
import globalize = require("globalize");
|
|
import * as globalizeCompiler from "globalize-compiler";
|
|
|
|
let extractsArray: globalizeCompiler.FormatterOrParserFunction[];
|
|
|
|
const templateFunction: (options: globalizeCompiler.CompileTemplateOptions) => string =
|
|
(options: globalizeCompiler.CompileTemplateOptions): string => {
|
|
const deps: string[] = options.dependencies;
|
|
const code: string = options.code;
|
|
return `${deps.join(';')}${code}`;
|
|
};
|
|
|
|
let compileOutput: string;
|
|
compileOutput = globalizeCompiler.compile(extractsArray);
|
|
compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x });
|
|
compileOutput = globalizeCompiler.compile(extractsArray, { template: templateFunction });
|
|
compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x }, { template: templateFunction });
|
|
|
|
let extractOutput: globalizeCompiler.ExtractFunction;
|
|
extractOutput = globalizeCompiler.extract("path");
|
|
|
|
const ast: ESTree.Program = undefined;
|
|
extractOutput = globalizeCompiler.extract(ast);
|
|
|
|
extractsArray = extractOutput(globalize);
|
|
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en" });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", messages: {} });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", template: templateFunction });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", messages: {}, template: templateFunction });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {} });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, messages: {} });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, template: templateFunction });
|
|
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, messages: {}, template: templateFunction });
|