本文整理汇总了TypeScript中lodash.toLower函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toLower函数的具体用法?TypeScript toLower怎么用?TypeScript toLower使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toLower函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: summarize
export function summarize(statement: string): StatementSummary {
for (const keyword in keywords) {
if (_.startsWith(_.toLower(statement), _.toLower(keyword))) {
const tablePattern = keywords[keyword];
const tableMatch = tablePattern.exec(statement);
if (!tableMatch) {
return {
error: "unable to find table for " + keyword + " statement",
};
}
let table = tableMatch[1];
if (table[0] === "\"" && table[table.length - 1] === "\"") {
table = table.slice(1, table.length - 1);
}
return {
statement: keyword,
table: table,
};
}
}
return {
error: "unimplemented",
};
}
示例2:
$('#aliases .alias').each(function() {
var tag = $(this).find('.tag input').val();
var user = $(this).find('.user input').val();
var name = _.toLower(tag);
if (aliases[name] || !tag || _.includes(tag, ' ')) return;
aliases[name] = {tag: tag, user: user};
});
示例3: function
export default function(len: number, str: string) {
var kw = _.trim(_.toLower(str)), hsv = true;
if (kw == 'rainbow') str = 'hsv:red/violet';
else hsv = _.startsWith(kw, 'hsv:');
if (_.startsWith(kw, 'rgb:') || hsv) str = str.substr(4);
var cols = _.map(str.split('/'), function(v) { return parseColor(v) || tinycolor('black'); });
return _.times(len, function(i) { return colorLerp(i/(len-1), cols, hsv).toHexString(); });
};
示例4: getComparator
private getComparator(columnType: string) {
switch (_.toLower(columnType)) {
case 'number':
return numberComparator
default:
return defaultComparator
}
}
示例5: normalize_and_validate_bcp47_locale
/** validate that given locale is a correct "BCP 47 locale code"
* and try to fix it if needed.
* returns undef if not valid.
*/
function normalize_and_validate_bcp47_locale(suspicious_locale: string | undefined): BCP47Locale | undefined {
if(! suspicious_locale) return
if(! _.isString(suspicious_locale)) return
if(suspicious_locale.length < 2) return
// TODO more, one day ;-)
return _.toLower(suspicious_locale)
}
示例6: function
export default function(v: string) {
switch (_.toLower(v)) {
case 'v3original': return 'Original';
case 'v3rp': return 'RP';
case 'v3rpaux': return 'Aux RP';
case 'r9k': return 'ROBOT9000';
default: return v;
}
};
示例7: function
_.forEach(tokens.testnet.eth.tokens, function(value) {
if (testnetTokens[value.type]) {
throw new Error('token : ' + value.type + ' duplicated.');
}
testnetTokens[value.type] = true;
if (value.tokenContractAddress !== _.toLower(value.tokenContractAddress)) {
throw new Error('token contract: ' + value.type + ' is not all lower case: ' + value.tokenContractAddress);
}
});
示例8: orderByType
function orderByType(data, type) {
switch (type) {
case SortTypes.String:
return toLower(data)
case SortTypes.Date:
return Date.parse(data)
case SortTypes.Float:
return parseFloat(data)
default:
return data
}
}
示例9: openPage
function openPage(id: string) {
id = _.toLower(id); location.hash = '#'+id; if (id == page) return;
var data: HelpData = helpData[id] || helpData['404'];
var content = data.data(), title = data.title;
content = _.map(content, function(v: any) { return _.isString(v) ? _.escape(v) : v; });
if (page === false) $('#title').text(title);
else if (_.isNull(page)) {
$('#title').text(title); $('#content').append(content).hide().fadeIn('fast');
} else {
$('#title').fadeOut(function() { $('#title').text(title).fadeIn(); });
$('#content').slideUp(function() { $('#content').empty().append(content).slideDown(); });
}
page = id;
}