本文整理汇总了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`)
}
});
开发者ID:rey-symphony,项目名称:node-symphony,代码行数:8,代码来源:Member.ts
示例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;
}
开发者ID:0x01feng,项目名称:grafana,代码行数:60,代码来源:datemath.ts
示例3: enroll
public enroll(attendee: TAttendee): Promise<boolean> {
if (!_.contains(this._attendees, attendee)) {
this._attendees.push(attendee);
}
return Promise.resolve(true);
}
开发者ID:adamcarr,项目名称:forge-di-smithy,代码行数:7,代码来源:Lecture.ts
示例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);
};
开发者ID:BloodyEnterprise,项目名称:atom-json-schema,代码行数:7,代码来源:bower-provider.ts
示例5: onkoOikeudet
function onkoOikeudet(target, permission) {
if (oikeudet) {
if (_.contains(oikeudet[target], permission)) {
return true;
}
}
return false;
}
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:8,代码来源:perusteprojekti.ts
示例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 });
}
})
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:8,代码来源:tree.ts
示例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;
}
开发者ID:elastic,项目名称:kibana,代码行数:9,代码来源:can_redirect_request.ts
示例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);
});
}
}
开发者ID:filipstachura,项目名称:sensas-platform,代码行数:9,代码来源:index.ts
示例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]);
}
});
开发者ID:AlbertXiebnu,项目名称:tensorflow,代码行数:9,代码来源:storage.ts
示例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};`;
}
}
})
开发者ID:david-driscoll,项目名称:atom-typescript-generator,代码行数:23,代码来源:Project.ts
注:本文中的lodash.contains函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论