本文整理汇总了TypeScript中lodash.indexOf函数的典型用法代码示例。如果您正苦于以下问题:TypeScript indexOf函数的具体用法?TypeScript indexOf怎么用?TypeScript indexOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了indexOf函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: removeSelectPart
removeSelectPart(selectParts, part) {
// if we remove the field remove the whole statement
if (part.def.type === 'field') {
if (this.selectModels.length > 1) {
var modelsIndex = _.indexOf(this.selectModels, selectParts);
this.selectModels.splice(modelsIndex, 1);
}
} else {
var partIndex = _.indexOf(selectParts, part);
selectParts.splice(partIndex, 1);
}
this.updatePersistedParts();
}
示例2: switch
_.forEach(commands, c => {
switch (c.type) {
case 'r':
const a = Number(c.args[0]);
if (Math.random() > 1 / a) {
isCondMatched = false;
return false;
}
break;
case 'c':
let count = 0;
for (let y = 0; y < 3; y++) {
for (let x = 0; x < 3; x++) {
const rc = rule.before[y][x];
const cl = getCell(sx + x, sy + y);
if (rc === ' ' && cl != null && _.indexOf(c.args[1], cl) >= 0) {
count++;
}
}
}
if (count !== Number(c.args[0])) {
isCondMatched = false;
return false;
}
break;
}
});
示例3: filterByTag
filterByTag(tag) {
if (_.indexOf(this.query.tag, tag) === -1) {
this.query.tag.push(tag);
this.search();
this.giveSearchFocus = this.giveSearchFocus + 1;
}
}
示例4: inRow
export function inRow(solid: string, sectionName: string, rowName: string) {
const { rows, data } = sections[sectionName];
const rowIndex = _.indexOf(rows, rowName);
const row = data[rowIndex];
// TODO deal with '!' stuff in tables
return hasDeep(row, toConwayNotation(solid));
}
示例5: search
// 쿼리 전송
public search(type: string, query: any, options): Promise<any> {
if (!_.isUndefined(query.resultFormat)) {
query.resultFormat.mode = _.indexOf(pivotChart, type.toString()) > -1 ? type : ChartType.BAR;
query.resultFormat.options = _.extend({}, { addMinMax: true }, options);
}
return this.post(this.API_URL + 'datasources/query/search', query);
}
示例6: function
_.each(options, function(value, key) {
if (_.indexOf(graphite_options, key) === -1) {
return;
}
if (value) {
clean_options.push(key + '=' + encodeURIComponent(value));
}
});
示例7: function
_.each(original.vuosiluokkakokonaisuudet, function(vlk) {
if (_.indexOf(removedVlkSet, "" + vlk._vuosiluokkaKokonaisuus) > -1) {
promises.push(
PerusopetusService.deleteOppiaineenVuosiluokkakokonaisuus(vlk, $scope.editableModel.id)
.$promise
);
}
});
示例8: moveRow
moveRow(direction) {
var rowsList = this.dashboard.rows;
var rowIndex = _.indexOf(rowsList, this.row);
var newIndex = rowIndex + direction;
if (newIndex >= 0 && newIndex <= (rowsList.length - 1)) {
_.move(rowsList, rowIndex, newIndex);
}
}
示例9:
response: response => {
const uudelleenohjausStatuskoodit = [401, 412, 500];
const fail = _.indexOf(uudelleenohjausStatuskoodit, response.status) !== -1;
if (fail) {
$rootScope.$emit("event:uudelleenohjattava", response.status);
}
return response || $q.when(response);
},