當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。