当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript underscore.pick函数代码示例

本文整理汇总了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;未经允许,请勿转载。