Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error: function() {
console.log(chalk.bold.red(sprintf.apply(undefined, arguments)));
},
return function(var_args) {
const message = format.apply(this, arguments);
if (strict) {
throw new gutil.PluginError('i18n_replace', message);
} else {
gutil.log('WARNING[i18n_replace]:', message);
}
}
}
tmp = tmp.receiver;
} else if (ExpTypes.PropertyWrite(tmp)) {
tmp = tmp.receiver;
} else if (ExpTypes.SafeMethodCall(tmp)) {
tmp = tmp.receiver;
} else if (ExpTypes.SafePropertyRead(tmp)) {
tmp = tmp.receiver;
} else if (ExpTypes.MethodCall(tmp)) {
tmp = tmp.receiver;
} else {
break;
}
}
if (ast.name && !available[ast.name]) {
let failureString = sprintf.apply(this, [Rule.FAILURE, symbolType, ast.name]);
const top = this.getTopSuggestion(Object.keys(available), ast.name);
const getSuggestion = (list: string[]) => {
if (list.length === 1) {
return `"${list[0]}"`;
}
let result = `"${list.shift()}"`;
while (list.length > 1) {
result += `, "${list.shift()}"`;
}
result += ` or "${list.shift()}"`;
return result;
};
if (top.length && top[0].distance <= 2) {
failureString += ` Probably you mean: ${getSuggestion(top.map(s => s.element))}.`;
}
const width = ast.name.length;
function format(n, parts, f) {
const out = [];
let nn = n;
while(parts.length) {
const p = parts.pop(), pn = nn % p;
out.unshift(pn);
nn = (nn - pn) / p;
}
out.unshift(nn);
out.unshift(f);
return sprintf.apply(null, out);
}
function error(var_args) {
const message = format.apply(this, arguments);
throw new gutil.PluginError('i18n_replace', message);
}
module.exports = function (options) {
if (!Array.isArray(options.message)) {
options.message = [options.message]
}
window.$.growl('<h4>' + options.header + '</h4>' + sprintf.apply(null, options.message), {
type: options.type ? options.type : 'info',
offset: 15
})
}
var sprintf = function(message, moduleName, data) {
if (typeof data === 'object') {
var dataValues = Object.keys(data).map(function(k) { return data[k]; });
try {
return Object.assign({}, data, {
message: sprintf2.apply(sprintf2, [message, moduleName].concat(dataValues)),
});
} catch (error) {}
}
return {
message: sprintf2(message, moduleName),
};
};
function print() {
let string = arguments[0];
if (arguments.length !== 1) {
string = sprintf.apply(sprintf, arguments);
}
process.stdout.write(string + os.EOL);
}