本文整理汇总了TypeScript中underscore.difference函数的典型用法代码示例。如果您正苦于以下问题:TypeScript difference函数的具体用法?TypeScript difference怎么用?TypeScript difference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了difference函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: stashNonTextUIElementsInEditBox
this.each(function() {
stashNonTextUIElementsInEditBox(this);
var html = $(this).html();
// ignore empty elements
if (html.trim().length > 0 && text.trim().length > 0) {
html = theOneLibSynphony.wrap_words_extra(
html,
results.sight_words,
cssSightWord,
' data-segment="word"'
);
html = theOneLibSynphony.wrap_words_extra(
html,
results.possible_words,
cssPossibleWord,
' data-segment="word"'
);
// remove numbers from list of bad words
var notFound = _.difference(
results.remaining_words,
results.getNumbers()
);
html = theOneLibSynphony.wrap_words_extra(
html,
notFound,
cssWordNotFound,
' data-segment="word"'
);
$(this).html(html);
}
restoreNonTextUIElementsInEditBox(this);
});
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:35,代码来源:jquery.text-markup.ts
示例2: ArrayToTreeToTemplateToData
public static ArrayToTreeToTemplateToData(list: Property[], extra?: any) {
let tree = Tree.ArrayToTree(list)
let template: { [key: string]: any } = Tree.TreeToTemplate(tree)
let data
if (extra) {
// DONE 2.2 支持引用请求参数
let keys = Object.keys(template).map(item => item.replace(RE_KEY, '$1'))
let extraKeys = _.difference(Object.keys(extra), keys)
let scopedData = Tree.TemplateToData(
Object.assign({}, _.pick(extra, extraKeys), template),
)
for (const key in scopedData) {
if (!scopedData.hasOwnProperty(key)) continue
let data = scopedData[key]
for (const eKey in extra) {
if (!extra.hasOwnProperty(eKey)) continue
const pattern = new RegExp(`\\$${eKey}\\$`, 'g')
if (data && pattern.test(data)) {
data = scopedData[key] = data.replace(pattern, extra[eKey])
}
}
}
data = _.pick(scopedData, keys)
} else {
data = Tree.TemplateToData(template)
}
return data
}
开发者ID:tonyjt,项目名称:rap2-delos,代码行数:29,代码来源:tree.ts
示例3: on
on(actions.tabsClosed, (state, action) => {
const { tabs, andFocus } = action.payload;
return {
...state,
openTabs: difference(state.openTabs, tabs),
tab: andFocus ? andFocus : state.tab,
};
});
开发者ID:itchio,项目名称:itch,代码行数:8,代码来源:navigation.ts
示例4: drawCompleteGraph
drawCompleteGraph(CustomObj, 'custom', () => {
let missing_genes = _.difference(genes, graph.getData().labels);
if (missing_genes.length > 0) {
let error = new Error()
error.name = "Missing Genes";
error.message = missing_genes.join(',');
errorHandler(error, 'warning', true);
}
});
开发者ID:delosh653,项目名称:SemNExT-Visualizations,代码行数:9,代码来源:ui.ts
示例5: _getSelectedPlugs
_getSelectedPlugs(item: DimItem) {
if (!item.sockets) {
return null;
}
const allPlugs = compact(item.sockets.sockets.map((i) => i.plug).map((i) => i && i.plugItem.hash));
return _.difference(allPlugs, this._getPowerMods(item));
}
开发者ID:delphiactual,项目名称:DIM,代码行数:9,代码来源:d2-itemTransformer.ts
示例6: randomizedKingdomCards
export function randomizedKingdomCards(forcedCards: Card[], allCards: Card[], numCards: number) : Card[] {
if (forcedCards.length >= numCards) {
return forcedCards;
}
const randomOptions = _.difference<Card>(allCards, forcedCards);
const randomCards = _.sample<Card>(randomOptions, numCards - forcedCards.length);
return forcedCards.concat(randomCards);
};
开发者ID:scottostler,项目名称:conspirator,代码行数:9,代码来源:cards.ts
示例7: getSelectedPlugs
function getSelectedPlugs(item: D2Item, powerModHashes: number[]): number[] {
if (!item.sockets) {
return [];
}
const allPlugs = compact(
item.sockets.sockets.map((i) => i.plug).map((i) => i && i.plugItem.hash)
);
return _.difference(allPlugs, powerModHashes);
}
开发者ID:bhollis,项目名称:DIM,代码行数:11,代码来源:d2-itemTransformer.ts
示例8: check_options_correctness_against_schema
export function check_options_correctness_against_schema(obj: any, schema: StructuredTypeSchema, options: any) {
if (!parameters.debugSchemaHelper) {
return; // ignoring set
}
options = options || {};
// istanbul ignore next
if (!_.isObject(options) && !(typeof(options) === "object")) {
let message = chalk.red(" Invalid options specified while trying to construct a ")
+ " " + chalk.yellow(schema.name);
message += "\n";
message += chalk.red(" expecting a ") + chalk.yellow(" Object ");
message += "\n";
message += chalk.red(" and got a ") + chalk.yellow((typeof options)) + chalk.red(" instead ");
// console.log(" Schema = ", schema);
// console.log(" options = ", options);
throw new Error(message);
}
// istanbul ignore next
if (options instanceof obj.constructor) {
return true;
}
// extract the possible fields from the schema.
const possibleFields = obj.constructor.possibleFields || schema._possibleFields;
// extracts the fields exposed by the option object
const currentFields = Object.keys(options);
// get a list of field that are in the 'options' object but not in schema
const invalidOptionsFields = _.difference(currentFields, possibleFields);
/* istanbul ignore next */
if (invalidOptionsFields.length > 0) {
// tslint:disable:no-console
console.log("expected schema", schema.name);
console.log(chalk.yellow("possible fields= "), possibleFields.sort().join(" "));
console.log(chalk.red("current fields= "), currentFields.sort().join(" "));
console.log(chalk.cyan("invalid_options_fields= "), invalidOptionsFields.sort().join(" "));
console.log("options = ", options);
}
if (invalidOptionsFields.length !== 0) {
throw new Error(" invalid field found in option :" + JSON.stringify(invalidOptionsFields));
}
return true;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:49,代码来源:factories_structuredTypeSchema.ts
示例9: moment
data.setupFeedHealth = (feedsArray: any)=>{
var processedFeeds: any[] = [];
if(feedsArray) {
var processed: any[] = [];
var arr: any[] = [];
_.each(feedsArray, (feedHealth: any) =>{
//pointer to the feed that is used/bound to the ui/service
var feedData = null;
if (data.feedSummaryData[feedHealth.feed]) {
feedData = data.feedSummaryData[feedHealth.feed]
angular.extend(feedData, feedHealth);
feedHealth = feedData;
}
else {
data.feedSummaryData[feedHealth.feed] = feedHealth;
feedData = feedHealth;
}
arr.push(feedData);
processedFeeds.push(feedData);
if (feedData.lastUnhealthyTime) {
feedData.sinceTimeString = moment(feedData.lastUnhealthyTime).fromNow();
}
this.OpsManagerFeedService.decorateFeedSummary(feedData);
if(feedData.stream == true && feedData.feedHealth){
feedData.runningCount = feedData.feedHealth.runningCount;
if(feedData.runningCount == null){
feedData.runningCount =0;
}
}
if(feedData.running){
feedData.timeSinceEndTime = feedData.runTime;
feedData.runTimeString = '--';
}
processed.push(feedData.feed);
});
var keysToRemove=_.difference(Object.keys(data.feedSummaryData),processed);
if(keysToRemove != null && keysToRemove.length >0){
_.each(keysToRemove,(key: any)=>{
delete data.feedSummaryData[key];
})
}
data.feedsArray = arr;
}
return processedFeeds;
};
开发者ID:prashanthc97,项目名称:kylo,代码行数:49,代码来源:OpsManagerDashboardService.ts
示例10: list
/**
* LIST operation of CFS. List files at given location. Tree traversal.
* @param ofPath Location folder to list files.
* @param localLevel Limit listing to local level.
* @returns {*} Promise of file names.
*/
async list(ofPath:string): Promise<string[]> {
const dirPath = path.normalize(ofPath);
let files: string[] = [], folder = path.join(this.rootPath, dirPath);
const hasDir = await this.qfs.exists(folder);
if (hasDir) {
files = files.concat(await this.qfs.list(folder));
}
const hasDeletedFiles = await this.qfs.exists(this.deletedFolder);
if (hasDeletedFiles) {
const deletedFiles = await this.qfs.list(this.deletedFolder);
const deletedOfThisPath = deletedFiles.filter((f:string) => f.match(new RegExp('^' + this.toRemoveDirName(dirPath))));
const locallyDeletedFiles = deletedOfThisPath.map((f:string) => f.replace(this.toRemoveDirName(dirPath), '')
.replace(/^__/, ''));
files = _.difference(files, locallyDeletedFiles);
}
return _.uniq(files);
};
开发者ID:duniter,项目名称:duniter,代码行数:23,代码来源:CFSCore.ts
注:本文中的underscore.difference函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论