Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_getLines() {
const lines = [];
const numLines = this.get('lines');
const text = this.get('text') || '';
const textToTruncate = isHTMLSafe(text) ? this._unescapeText(text) : text;
const formattedText = this.stripText ? this._stripBrTags(textToTruncate) : this._convertBrTags(textToTruncate);
const textLines = formattedText.split('\n').map(line => line.trim().split(' '));
let didTruncate = true;
const ellipsisWidth = this._getEllipsisWidth();
for (let line = 1; line <= numLines; line += 1) {
const textWords = textLines[0];
// handle new line -- ???
if (textWords.length === 0) {
lines.push({
newLine: true,
});
textLines.shift();
line -= 1;
show(type, text, options) {
// If the text passed is `SafeString`, convert it
if (isHTMLSafe(text)) {
text = text.toString();
}
if (typeof text === 'object') {
options = text;
text = null;
}
let message = Message.create(assign({
text: text,
type: type
}, options));
if (this.target) {
this.target.show(message);
} else {
function isSafeString(input) {
return typeof isHTMLSafe === 'function' ? isHTMLSafe(input) : input instanceof Handlebars.SafeString;
}
compute([inputStr], overrideOptions) {
if (!inputStr) {
return '';
}
const currentOptions = this._mergeOptions(overrideOptions);
const initialEmojiOneOptions = this._captureEmojiOneInitialState();
const isInputHtmlSafe = isHTMLSafe(inputStr);
this._applyOptionsToEmojiOne(currentOptions.emojione);
const result = this._injectEmoji(inputStr.toString(), currentOptions);
this._applyOptionsToEmojiOne(initialEmojiOneOptions);
return isInputHtmlSafe
? htmlSafe(result)
: result;
},
export function unwrapString(s) {
if (isHTMLSafe(s)) {
return s.toString();
}
return s;
}
export function humanize([string]) {
if (isHTMLSafe(string)) {
string = string.string;
}
if (string === undefined || string === null) {
return '';
}
let result = string.toLowerCase().replace(regex, replacement);
return result.charAt(0).toUpperCase() + result.slice(1);
}
filteredBy.forEach((filterValue, filterBy) => {
let itemValue = listItem.get(filterBy);
if (!isEmpty(filterValue)) {
if (isHTMLSafe(filterValue)) {
filterValue = filterValue.toString();
} else if (filterValue instanceof Date) {
filterValue = filterValue.getTime();
}
if (isHTMLSafe(itemValue)) {
itemValue = itemValue.toString();
} else if (itemValue instanceof Date) {
itemValue = itemValue.getTime();
}
if (itemValue !== filterValue) {
includeRecord = false;
}
}
});
return includeRecord;
truncatedText: computed('text', 'length', 'isHTML', 'maxLines', function() {
const options = { html: this.get('isHTML'), maxLines: this.get('maxLines') };
const text = this.get('text');
if (!text) { return null; }
const string = isHTMLSafe(text) ? text.string : text;
return htmlSafe(clip(string, this.get('length'), options));
}).readOnly(),