• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript underscore.pick函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中underscore.pick函数的典型用法代码示例。如果您正苦于以下问题:TypeScript pick函数的具体用法?TypeScript pick怎么用?TypeScript pick使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pick函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: reset

  reset() {
    const svgNode = this.scope.svg.node();
    const mx = d3.mouse(svgNode)[0];
    const my = d3.mouse(svgNode)[1];

    const t = d3.zoomIdentity.translate(0, 0).scale(1);
    this.scope.svg.call(this.scope.plotZoom.zoomObj.transform, t);

    const lMargin = this.scope.layout.leftLayoutMargin;
    const bMargin = this.scope.layout.bottomLayoutMargin;
    const H = plotUtils.safeHeight(this.scope.jqsvg);

    if (mx < lMargin && my < H - bMargin) {
      _.extend(this.focus, _.pick(this.defaultFocus, "yl", "yr", "yspan", "yl_r", "yr_r", "yspan_r"));
    } else if (my > H - bMargin && mx > lMargin) {
      _.extend(this.focus, _.pick(this.defaultFocus, "xl", "xr", "xspan"));
    } else {
      _.extend(this.focus, this.defaultFocus);
    }

    this.fix(this.focus);
    this.scope.plotRange.calcMapping(true);
    this.scope.emitZoomLevelChange();
    this.scope.update();
  }
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:25,代码来源:PlotFocus.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: callbacks

 get callbacks(): CrawlCallbacks {
   return _.pick(this.config, [
     'success',
     'failure',
     'finished'
   ]);
 }
开发者ID:antivanov,项目名称:js-crawler,代码行数:7,代码来源:configuration.ts


示例4: function

 static respondToResourceGET<T>(requestBody, res, dao: DAO<T>, whereArray: string[], likeArray: string[]) {
     let whereQuery = _.omit(_.pick(requestBody, whereArray),
         function (value, key, object) {
             return value === "";
         });
     let likeQuery_ = _.chain(requestBody)
         .pick(requestBody, likeArray)
         .omit(function (value, key, object) {
             return value === "";
         }).value();
     let likeQuery = _.mapObject(likeQuery_, function (value, key) {
         return "%" + value + "%";
     });
     dao.find({
         where: whereQuery, like: likeQuery, orderBy: requestBody.orderBy
     }, function (err, results) {
         if (err) {
             APIHelper.sendDatabaseErrorResponse(res, err);
         } else {
             if (results.length === 0) {
                 APIHelper.sendNotFoundResponse(res, "Not found.");
             } else {
                 APIHelper.sendResponse(res, results);
             }
         }
     });
 }
开发者ID:JohanBaskovec,项目名称:libraryBackEnd,代码行数:27,代码来源:apiHelper.ts


示例5: String

		var action = String(function (args) {
			var gm = require("@arangodb/general-graph");
			var graph = gm._graph('qaGraph');
			var _ = require('underscore');
			var answerData = _.pick(args[0], 'chosen', 'opinion');
			answerData.updatedAt = new Date();
			return graph.answer.update(args[0]._key, answerData);
		});
开发者ID:andregs,项目名称:think-before-voting,代码行数:8,代码来源:answer.router.ts


示例6: String

		var action = String(function (args) {
			var gm = require("@arangodb/general-graph");
			var graph = gm._graph('qaGraph');
			var _ = require('underscore');
			var questionData = _.pick(args[0], 'title', 'options');
			questionData.updatedAt = new Date();
			return graph.question.update(args[0]._key, questionData);
		});
开发者ID:andregs,项目名称:think-before-voting,代码行数:8,代码来源:question.router.ts


示例7: View

export function View(options) {
  this.cid = _.uniqueId('view');
  options || (options = {});
  _.extend(this, _.pick(options, viewOptions));
  this._ensureElement();
  this.initialize.apply(this, arguments);
  this.delegateEvents();
};
开发者ID:Volicon,项目名称:NestedTypes,代码行数:8,代码来源:backbone.ts


示例8: h

 node.on((data, key, at, ev) => {
     if (signal.stop) {
         ev.off();
     } else {
         // modifying data directly does not seem to work...
         h(cleanup ? pick(data, (v, k, o) => v !== null && k !== '_') : data);
     }
 });
开发者ID:amark,项目名称:gun,代码行数:8,代码来源:gun.helper.ts


示例9: String

		var action = String(function (args) {
			var _ = require("underscore");
			var gm = require("@arangodb/general-graph");
			var graph = gm._graph('partyGraph');
			var party = graph.party.document(args[0]);
			var user = graph.user.document(args[1].user._key);
			var location = graph.location.document(args[1].candidate.location._key);
			var memberData = { admin: args[1].admin };
			var candidateData = { office: args[1].candidate.office };
			var member = graph.member.save(party._id, user._id, memberData);
			var candidate = graph.candidate.save(user._id, location._id, candidateData);
			return _.extend(
				member,
				memberData,
				{ user: _.pick(user, '_key', 'name', 'nickname') },
				{ candidate: _.extend(candidate, candidateData, { location: _.pick(location, '_key', 'name') }) },
			);
		});
开发者ID:andregs,项目名称:think-before-voting,代码行数:18,代码来源:party.router.ts


示例10: ArrayToTreeToTemplateToData

  public static ArrayToTreeToTemplateToData(list: Property[], extra?: any) {
    let tree = Tree.ArrayToTree(list)
    let template = 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)
      )
      data = _.pick(scopedData, keys)
    } else {
      data = Tree.TemplateToData(template)
    }

    return data
  }
开发者ID:zerolugithub,项目名称:rap2-delos,代码行数:19,代码来源:tree.ts



注:本文中的underscore.pick函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript underscore.pluck函数代码示例发布时间:2022-05-25
下一篇:
TypeScript underscore.partial函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap