本文整理汇总了TypeScript中lodash.contains函数的典型用法代码示例。如果您正苦于以下问题:TypeScript contains函数的具体用法?TypeScript contains怎么用?TypeScript contains使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contains函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
}).then((body) => {
return {
memberId: body ? body.id : null,
memberEmail: body ? body.email : null,
hasPermissions: _.contains(body ? body.organizationsWithSite : null, site),
isSymphonyEmployee: _.contains(body ? body.email : null, `symphonycommerce`)
}
});
示例2: parseDateMath
export function parseDateMath(mathString, time, roundUp?) {
var dateTime = time;
var i = 0;
var len = mathString.length;
while (i < len) {
var c = mathString.charAt(i++);
var type;
var num;
var unit;
if (c === '/') {
type = 0;
} else if (c === '+') {
type = 1;
} else if (c === '-') {
type = 2;
} else {
return undefined;
}
if (isNaN(mathString.charAt(i))) {
num = 1;
} else if (mathString.length === 2) {
num = mathString.charAt(i);
} else {
var numFrom = i;
while (!isNaN(mathString.charAt(i))) {
i++;
if (i > 10) { return undefined; }
}
num = parseInt(mathString.substring(numFrom, i), 10);
}
if (type === 0) {
// rounding is only allowed on whole, single, units (eg M or 1M, not 0.5M or 2M)
if (num !== 1) {
return undefined;
}
}
unit = mathString.charAt(i++);
if (!_.contains(units, unit)) {
return undefined;
} else {
if (type === 0) {
if (roundUp) {
dateTime.endOf(unit);
} else {
dateTime.startOf(unit);
}
} else if (type === 1) {
dateTime.add(num, unit);
} else if (type === 2) {
dateTime.subtract(num, unit);
}
}
}
return dateTime;
}
示例3: enroll
public enroll(attendee: TAttendee): Promise<boolean> {
if (!_.contains(this._attendees, attendee)) {
this._attendees.push(attendee);
}
return Promise.resolve(true);
}
示例4: fetch
var getReleases = (res: BowerResult) => {
if (!_.contains(res.url, 'github')) {
return;
}
var url = res.url.replace('.git', '/tags').replace('git://github.com/', 'https://api.github.com/repos/');
return fetch(url);
};
示例5: onkoOikeudet
function onkoOikeudet(target, permission) {
if (oikeudet) {
if (_.contains(oikeudet[target], permission)) {
return true;
}
}
return false;
}
示例6:
.each(function(osa) {
const match =
$scope.tutkinnonOsat.rajaus &&
_.contains(Kaanna.kaanna(osa.nimi).toLowerCase(), $scope.tutkinnonOsat.rajaus.toLowerCase());
if (!$scope.tutkinnonOsat.rajaus || match) {
uudetUniikit.push({ _tutkinnonOsaViite: osa.id });
}
})
示例7: canRedirectRequest
export function canRedirectRequest(request: Request) {
const hasVersionHeader = has(request.raw.req.headers, KIBANA_VERSION_HEADER);
const hasXsrfHeader = has(request.raw.req.headers, KIBANA_XSRF_HEADER);
const isApiRoute = contains(get(request, 'route.settings.tags'), ROUTE_TAG_API);
const isAjaxRequest = hasVersionHeader || hasXsrfHeader;
return !isApiRoute && !isAjaxRequest;
}
示例8: reportSignal
function reportSignal(signal) {
if (_.contains(acceptSignals, signal.name)) {
var signals = db.collection('signals');
Q.npost(signals, "insert", [signal])
.fail(function(err) {
console.log("insert error: ", err);
});
}
}
示例9: if
tokens.forEach((token) => {
const kv = token.split('=');
// Special backwards compatibility for URI components like #events
if (kv.length === 1 && _.contains(TABS, kv[0])) {
items[TAB] = kv[0];
} else if (kv.length === 2) {
items[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);
}
});
示例10:
_.map(this.exports, exp => {
// special cases
if (_.contains(exp.name, 'jQuery') || _.contains(exp.name, '$'))
return '';
var name = exp.name;
if (name === this.displayName) {
name = '_' + this.displayName;
}
var item = _.repeat(' ', indent + 4);
if (exp.project) {
return `${item}var ${exp.name} : typeof ${exp.projectName}.${exp.name};`;
} else {
var cls = _.find(classes, x => x.name === exp.name);
if (cls && ProjectConverted.getProjectDisplayName(cls.project) !== exp.name && !_.any(this.references, imp => imp.projectName === cls.name)) {
return `${item}class ${exp.name} extends ${ProjectConverted.getProjectDisplayName(cls.project) }.${exp.name} {}`;
} else {
//return `${item}export var ${exp.name} : typeof ${this.displayName}.${exp.name};`;
}
}
})