Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setup(aliases?: string[]) {
aliases = aliases || [];
const container = DI.createContainer(BindingCommand.define({ name: 't', aliases }, TranslationBindingCommand));
if (!aliases.includes('t')) {
aliases.push('t');
}
return aliases.reduce(
(acc: TranslationBindingCommand[], alias) => {
acc.push(
container.get(BindingCommand.keyFrom(alias)),
);
return acc;
},
[]);
}
function setup(aliases?: string[]) {
aliases = aliases || [];
aliases = aliases.map(alias => `${alias}.bind`);
const container = DI.createContainer(BindingCommand.define({ name: 't.bind', aliases }, TranslationBindBindingCommand));
if (!aliases.includes('t.bind')) {
aliases.push('t.bind');
}
return aliases.reduce(
(acc: TranslationBindBindingCommand[], alias) => {
acc.push(
container.get(BindingCommand.keyFrom(alias)),
);
return acc;
},
[]);
}
const bindAlias = `${alias}.bind`;
patterns.push({ pattern: alias, symbols: '' });
TranslationAttributePattern.registerAlias(alias);
bindPatterns.push({ pattern: bindAlias, symbols: '.' });
TranslationBindAttributePattern.registerAlias(alias);
if (alias !== 't') {
commandAliases.push(alias);
bindCommandAliases.push(bindAlias);
}
}
const renderers = [
AttributePattern.define(patterns, TranslationAttributePattern),
BindingCommand.define({ name: 't', aliases: commandAliases }, TranslationBindingCommand),
TranslationBindingRenderer,
AttributePattern.define(bindPatterns, TranslationBindAttributePattern),
BindingCommand.define({ name: 't.bind', aliases: bindCommandAliases }, TranslationBindBindingCommand),
TranslationBindBindingRenderer,
TranslationParametersAttributePattern,
TranslationParametersBindingCommand,
TranslationParametersBindingRenderer
];
return {
register(container) {
return container.register(Registration.callback(I18nInitOptions, () => options.initOptions), StartTask.with(I18N).beforeBind().call(i18n => i18n.task), Registration.singleton(I18nWrapper, I18nextWrapper), Registration.singleton(I18N, I18nService), ...renderers, ...translation);
}
};
}
const dateFormat = [
const commandAliases = [];
const bindCommandAliases = [];
for (const alias of aliases) {
const bindAlias = `${alias}.bind`;
patterns.push({ pattern: alias, symbols: '' });
TranslationAttributePattern.registerAlias(alias);
bindPatterns.push({ pattern: bindAlias, symbols: '.' });
TranslationBindAttributePattern.registerAlias(alias);
if (alias !== 't') {
commandAliases.push(alias);
bindCommandAliases.push(bindAlias);
}
}
const renderers = [
AttributePattern.define(patterns, TranslationAttributePattern),
BindingCommand.define({ name: 't', aliases: commandAliases }, TranslationBindingCommand),
TranslationBindingRenderer,
AttributePattern.define(bindPatterns, TranslationBindAttributePattern),
BindingCommand.define({ name: 't.bind', aliases: bindCommandAliases }, TranslationBindBindingCommand),
TranslationBindBindingRenderer,
TranslationParametersAttributePattern,
TranslationParametersBindingCommand,
TranslationParametersBindingRenderer
];
return {
register(container) {
return container.register(Registration.callback(I18nInitOptions, () => options.initOptions), StartTask.with(I18N).beforeBind().call(i18n => i18n.task), Registration.singleton(I18nWrapper, I18nextWrapper), Registration.singleton(I18N, I18nService), ...renderers, ...translation);
}
};
}
const dateFormat = [