本文整理汇总了TypeScript中lodash.reject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript reject函数的具体用法?TypeScript reject怎么用?TypeScript reject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reject函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const getColumnsAndRelated = (columns) => {
const withRelated = [];
if(_.includes(columns, 'organizationalunit.name')) {
columns.push('organizationalunitId');
withRelated.push('organizationalunit');
columns = _.reject(columns, testCol => testCol === 'organizationalunit.name');
}
if(_.includes(columns, 'location.name')) {
columns.push('locationId');
withRelated.push('location');
columns = _.reject(columns, testCol => testCol === 'location.name');
}
const vendorKeys = ['vendors[0].name', 'vendors[0].stockId', 'vendors[0].cost'];
if(_.some(vendorKeys, key => _.includes(columns, key))) {
columns.push('id');
withRelated.push('vendors');
_.each(vendorKeys, key => columns = _.reject(columns, testCol => testCol === key));
}
_.each(columns, col => {
if(!_.includes(col, '.length')) { return; }
columns = _.reject(columns, testCol => testCol === col);
});
return { columns: _.uniq(columns), withRelated };
};
示例2:
]).spread((uiDescriptor) => {
let vm = parentContext.object,
devices: any = _.map(
_.reject(vm.devices, {type: this.vmRepository.DEVICE_TYPE.VOLUME}),
device => _.assign(device, {
_objectType: Model.VmDevice,
_vm: vm,
id: uuid.v4()
})
);
context.object = devices;
context.object._vm = vm;
context.object._objectType = Model.VmDevice;
context.userInterfaceDescriptor = uiDescriptor;
context.changeListener = this.eventDispatcherService.addEventListener('VmDevicesChanged-' + (vm.id || 'new'), (newDevices) => {
context.object = _.map(
_.reject(newDevices, {type: this.vmRepository.DEVICE_TYPE.VOLUME}),
device => _.assign(device, {
_objectType: Model.VmDevice,
_vm: vm,
id: uuid.v4()
})
);
context.object._vm = vm;
context.object._objectType = Model.VmDevice;
});
return this.updateStackWithContext(this.stack, context);
});
示例3: function
$scope.tallennaTekstikappaleet = function(tekstikentat) {
var filtered = _.reject(tekstikentat, function(tk: any) {
return tk.$ladattu === true;
});
var doneSuccess = _.after(_.size(filtered), function() {
Notifikaatiot.onnistui("tallennus-onnistui");
$scope.uploadSuccessTekstikappaleet = true;
});
_.forEach(filtered, function(tk: any) {
tk.tila = "luonnos";
tk.osanTyyppi = "tekstikappale";
var viite = { perusteenOsa: tk };
SuoritustapaSisalto.save(
{
perusteId: $scope.haettuPeruste.id,
suoritustapa: $scope.suoritustapa || $scope.haettuPeruste.suoritustavat[0].suoritustapakoodi
},
viite,
function(re) {
tk.$ladattu = true;
tk.id = re._perusteenOsa;
doneSuccess();
},
function(err) {
tk.$syy = err.data.syy;
}
);
});
};
示例4: _transformUtxos
_transformUtxos(unspent, bcheight) {
$.checkState(bcheight > 0, 'No BC height passed to _transformUtxos');
const ret = _.map(
_.reject(unspent, x => {
return x.spentHeight && x.spentHeight <= -3;
}),
x => {
const u = {
address: x.address,
satoshis: x.value,
amount: x.value / 1e8,
scriptPubKey: x.script,
txid: x.mintTxid,
vout: x.mintIndex,
locked: false,
confirmations: x.mintHeight > 0 && bcheight >= x.mintHeight ? bcheight - x.mintHeight + 1 : 0
};
// v8 field name differences
return u;
}
);
return ret;
}
示例5: reject
export const translatePackFromDB = (
pack: StickerPackDBType,
packs: Dictionary<StickerPackDBType>,
blessedPacks: Dictionary<boolean>,
stickersPath: string,
tempPath: string
) => {
const { id, stickers, status, coverStickerId } = pack;
const isEphemeral = status === 'ephemeral';
// Sometimes sticker packs have a cover which isn't included in their set of stickers.
// We don't want to show cover-only images when previewing or picking from a pack.
const filteredStickers = reject(
values(stickers),
sticker => sticker.isCoverOnly
);
const translatedStickers = map(filteredStickers, sticker =>
translateStickerFromDB(sticker, stickersPath, tempPath, isEphemeral)
);
return {
...pack,
isBlessed: Boolean(blessedPacks[id]),
cover: getSticker(packs, id, coverStickerId, stickersPath, tempPath),
stickers: sortBy(translatedStickers, sticker => sticker.id),
};
};
示例6: affectedFixtures
export function affectedFixtures(changedFiles: string[] | undefined = undefined): Fixture[] {
if (changedFiles === undefined) {
const { BUILDKITE_PULL_REQUEST_BASE_BRANCH: base, BUILDKITE_COMMIT: commit } = process.env;
return commit === undefined ? allFixtures : affectedFixtures(getChangedFiles(base || "master", commit));
}
// We can ignore changes in Markdown files
changedFiles = _.reject(changedFiles, file => _.endsWith(file, ".md"));
// All fixtures are dirty if any changed file is not included as a sourceFile of some fixture.
const fileDependencies = _.flatMap(allFixtures, f => f.language.sourceFiles || []);
const allFixturesDirty = _.some(changedFiles, f => !_.includes(fileDependencies, f));
if (allFixturesDirty) return allFixtures;
const dirtyFixtures = allFixtures.filter(
fixture =>
// Fixtures that don't specify dependencies are always dirty
fixture.language.sourceFiles === undefined ||
// Fixtures that have a changed file are dirty
_.some(changedFiles, f => _.includes(fixture.language.sourceFiles, f))
);
return dirtyFixtures;
}
示例7: runExpire
private runExpire(): void {
if (this.cache.length <= 0) return;
this.cache = _.reject(this.cache, c => {
return c.addedAt < Moment().subtract(this.expiry, "minutes");
});
}
示例8: function
$scope.getTavoitteet = function(alue, pakollinen) {
if (pakollinen) {
return alue.$groups ? _.filter(alue.$groups.grouped[alue.$chosen], "pakollinen") : [];
}
var grouped = alue.$groups ? _.reject(alue.$groups.grouped[alue.$chosen], "pakollinen") : [];
var ungrouped = alue.$groups ? alue.$groups.ungrouped : [];
return grouped.concat(ungrouped);
};
示例9: removeOutlineNodesInternal
function removeOutlineNodesInternal(outline:IOutlineNode,
predicate:(outline:IOutlineNode) => boolean):IOutlineNode {
let filteredChildren = _.reject(outline.children, predicate)
outline.children = filteredChildren
_.forEach(outline.children, (currChild) => removeOutlineNodesInternal(currChild, predicate))
return outline
}