Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function category_badge_replacement(str, ctx) {
const category = Ember.get(ctx.contexts[0], str);
return categoryLinkHTML(category, {
allowUncategorized: true,
});
}
function bound_date_replacement(str, ctx) {
const value = Ember.get(ctx.contexts[0], str);
return new Handlebars.SafeString(
autoUpdatingRelativeAge(new Date(value), { title: true })
);
}
const esc = Handlebars.Utils.escapeExpression;
// consider moving this elsewhere
function guessUrl(t) {
let [dest, name] = [t, t];
const split = t.split(/,(.+)/);
if (split.length > 1) {
name = split[0];
dest = split[1];
}
return [dest, name];
}
const QueryRowContentComponent = Ember.Component.extend({
var data;
var i;
if (arguments.length === 3) {
// If given two numbers then pick a random one between the two
total = utils.randomInt(min, max);
} else if (arguments.length === 2) {
// If given one number then just use it as a fixed repeat total
options = max;
total = min;
} else {
throw new Error('The repeat helper requires a numeric param');
}
// Create a shallow copy of data so we can add variables without modifying the original
data = Handlebars.Utils.extend({}, options.data);
for (i = 0; i < total; i++) {
// Clear the linked values on each iteration so a new set of names/companies is generated
options.data.root.__cache = {};
// You can access these in your template using @index, @total, @first, @last
data.index = i;
data.total = total;
data.first = i === 0;
data.last = i === total - 1;
// By using 'this' as the context the repeat block will inherit the current scope
ret = ret + options.fn(this, {data: data});
if (options.hash.comma !== false) {
// Trim any whitespace left by handlebars and add a comma if it doesn't already exist,
parse: function (string, options) {
options = options || {};
// Merge custom mockdata/helpers into the defaults, items with the same name will override
options.mockdata = Handlebars.Utils.extend({}, mockdata, options.mockdata);
options.helpers = Handlebars.Utils.extend({}, helpers, options.helpers);
// If a seed is passed in the options it will override the default one
utils.setRandomSeed(options.seed || dummyjson.seed);
// Certain helpers, such as name and email, attempt to synchronise and use the same values when
// called after one-another. This object acts as a cache so the helpers can share their values.
options.mockdata.__cache = {};
return Handlebars.compile(string)(options.mockdata, {
helpers: options.helpers,
partials: options.partials
});
},
preview: function(key, val) {
var url = 'https://freegeoip.net/?q=' + val;
return [
'<a href="',
Handlebars.Utils.escapeExpression(url),
'" rel="noreferrer">',
Handlebars.Utils.escapeExpression(val),
'</a>'
].join('');
},
render: function(key, val, data) {
Handlebars.registerHelper('formatMonth', function(text/*, options*/) {
text = Handlebars.Utils.escapeExpression(text);
text = Helper.formatMonth(text);
return new Handlebars.SafeString(text);
});
Handlebars.registerHelper('formatMonthYear', function(params) {
HHelpers.nl2br = function(text) {
text = Handlebars.Utils.escapeExpression(text);
var nl2br = (text + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br>' + '$2');
return new Handlebars.SafeString(nl2br);
};
Handlebars.registerHelper('nl2br', HHelpers.nl2br);
Handlebars.registerHelper('source', function(options) {
var out = '<pre class="prettyprint linenums">' + (Handlebars.Utils.escapeExpression(options.fn(this))).trim() + '</pre>';
return new Handlebars.SafeString(out);
});
module.exports = function (name, url, isComment) {
name = Handlebars.Utils.escapeExpression(name);
url = Handlebars.Utils.escapeExpression(url);
var str = '';
if (name !== '') {
if (isComment === undefined) {
isComment = false;
}
if (!isComment) {
str += 'by ';
}
if (url && url !== '') {
str += "<a name="" rel="nofollow" href="" + url + "">';</a>
module.exports = function (text) {
text = Handlebars.Utils.escapeExpression(text);
text = text.replace(/(\r\n|\n|\r)/gm, '<br>');
return new Handlebars.SafeString(text);
};
Handlebars.registerHelper("list_link", function(text, url) {
text = Handlebars.Utils.escapeExpression(text);
url = Handlebars.Utils.escapeExpression(url);
var result = "' + text + "";
return new Handlebars.SafeString(result);
});