當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript underscore.extend函數代碼示例

本文整理匯總了TypeScript中underscore.extend函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript extend函數的具體用法?TypeScript extend怎麽用?TypeScript extend使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了extend函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: format

// Converts a map to a string space-delimited key=val pairs
function format(data) {
  if (deploy_env || workflow_id || pod_id || pod_account || pod_region) {
    const extras: any = {};
    if (deploy_env) { extras.deploy_env = deploy_env; }
    if (workflow_id) { extras.wf_id = workflow_id; }
    if (pod_id) { extras["pod-id"] = pod_id; }
    if (pod_region) { extras["pod-region"] = pod_region; }
    if (pod_account) { extras["pod-account"] = pod_account; }

    return JSON.stringify(_.extend(extras, data), replaceErrors);
  }
  return JSON.stringify(data, replaceErrors);
}
開發者ID:Clever,項目名稱:kayvee-js,代碼行數:14,代碼來源:kayvee.ts

示例2: sendType1Message

 // The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
 private sendType1Message(httpClient, protocol, options, objs, keepaliveAgent, callback): void {
     var type1msg = ntlm.createType1Message(options);
     var type1options = {
         headers: {
             'Connection': 'keep-alive',
             'Authorization': type1msg
         },
         timeout: options.timeout || 0,
         agent: keepaliveAgent,
          // don't redirect because http could change to https which means we need to change the keepaliveAgent
         allowRedirects: false
     };
     type1options = _.extend(type1options, _.omit(options, 'headers'));
     httpClient.requestInternal(protocol, type1options, objs, callback);
 }
開發者ID:grawcho,項目名稱:vsts-node-api,代碼行數:16,代碼來源:ntlm.ts

示例3: function

    select: function (label:string, args: any, options: OptionObj[]) : _mithril.MithrilVirtualElement {
        var id = label.replace(/\s/g, '');
        return  [
            m('label', {
                for: 'id'
            }, [
                label,
                m('select', _.extend({
                    name: id,
                    id: id
                }, args), _.map(options, objToOption))
            ]),

        ];
    },
開發者ID:SleepyPierre,項目名稱:BarHigher_Proto,代碼行數:15,代碼來源:form.ts

示例4: fix

  fix(focus: Focus) {
    focus.xl = focus.xl < 0 ? 0 : focus.xl;
    focus.xr = focus.xr > 1 ? 1 : focus.xr;
    focus.yl = focus.yl < 0 ? 0 : focus.yl;
    focus.yr = focus.yr > 1 ? 1 : focus.yr;
    focus.yl_r = focus.yl_r < 0 ? 0 : focus.yl_r;
    focus.yr_r = focus.yr_r > 1 ? 1 : focus.yr_r;
    focus.xspan = focus.xr - focus.xl;
    focus.yspan = focus.yr - focus.yl;
    focus.yspan_r = focus.yr_r - focus.yl_r;

    if (focus.xl > focus.xr || focus.yl > focus.yr || focus.yl_r > focus.yr_r) {
      console.error("visible range specified does not match data range, " +
        "enforcing visible range");
      _.extend(focus, this.defaultFocus);
    }
  }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:17,代碼來源:PlotFocus.ts

示例5: _internalAnalyzePacket

function _internalAnalyzePacket(buffer: Buffer, stream: BinaryStream, objMessage: any, padding: number, customOptions?: AnalyzePacketOptions, offset?: number) {

    let options: any = make_tracer(buffer, padding, offset);
    options.name = "message";
    options = _.extend(options, customOptions);
    try {
        if (objMessage) {
            objMessage.decodeDebug(stream, options);
        } else {
            console.log(" Invalid object", objMessage);
        }
    } catch (err) {
        console.log(" Error in ", err);
        console.log(" Error in ", err.stack);
        console.log(" objMessage ", util.inspect(objMessage, {colors: true}));
    }
}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:17,代碼來源:packet_analyzer.ts

示例6: Exec

    public static async Exec(tfvc: ITfCommandLine, cwd: string, args: IArgumentProvider, options: any = {}): Promise<IExecutionResult> {
        // default to the cwd passed in, but allow options.cwd to overwrite it
        options = _.extend({ cwd }, options || {});

        // TODO: do we want to handle proxies or not for the EXE? for tf.exe the user could simply setup the proxy at the command line.
        //       tf.exe remembers the proxy settings and uses them as it needs to.
        if (tfvc.proxy && !tfvc.isExe) {
            args.AddProxySwitch(tfvc.proxy);
        }

        Logger.LogDebug(`TFVC: tf ${args.GetArgumentsForDisplay()}`);
        if (options.log !== false) {
            TfvcOutput.AppendLine(`tf ${args.GetArgumentsForDisplay()}`);
        }

        return await TfCommandLineRunner.run(tfvc, args, options, tfvc.isExe);
    }
開發者ID:Microsoft,項目名稱:vsts-vscode,代碼行數:17,代碼來源:tfcommandlinerunner.ts

示例7:

      this.http.get(url).forEach(response => {
        let tempState = window.history.state;

        let a = response.json();
        if (a.data[0] !== 'Authorized') {
          this.appState.set('authenticated', true);
          this.appState.set('learn', true);
          this.router.navigate(['/welcome']);
          window.history.replaceState(undefined, undefined, '');
        } else {
          this.appState.set('authenticated', true);
          this.appState.set('isDisabled', false);
          this.router.navigate([`/${page}`]);
          tempState = _.extend(tempState, this.appState._state);
          window.history.pushState(tempState, undefined, page);
        }
      }).catch(err => console.log('ERROR:', err));
開發者ID:mybrainishuge,項目名稱:hello,代碼行數:17,代碼來源:auth.service.ts

示例8: function

var DataForm = function (app, options) {
  this.app = app;
  app.locals.formsAngular = app.locals.formsAngular || [];
  app.locals.formsAngular.push(this);
  this.mongoose = mongoose;
  this.options = _.extend({
    urlPrefix: '/api/'
  }, options || {});
  this.resources = [ ];
  this.searchFunc = async.forEach;
  this.registerRoutes();
  this.app.get.apply(this.app, processArgs(this.options, ['search', this.searchAll()]));
  if (this.options.JQMongoFileUploader) {
    var JqUploadModule = this.options.JQMongoFileUploader.module || require('fng-jq-upload').Controller;
    this.fileUploader = new JqUploadModule(this, processArgs, this.options.JQMongoFileUploader);
    void (this.fileUploader);  // suppress warning
  }
};
開發者ID:zettacristiano,項目名稱:forms-angular,代碼行數:18,代碼來源:data_form.ts

示例9:

      this.http.get(url).forEach(response => {
        var tempState = window.history.state;

        let a = response.json();
        if(a.data[0] !== "Authorized") {
          this.appState.set('authenticated', true);
          this.appState.set('learn', true);
          this.router.navigate(['/welcome']);
          window.history.replaceState(null, null, '');
        } else {
          this.appState.set('authenticated', true);
          this.appState.set('isDisabled', false);
          this.router.navigate(['/'+page]);
          tempState = _.extend(tempState, this.appState._state);
          console.log('temp', tempState);
          window.history.pushState(tempState, null, page);
        }
      }).catch(err => console.log("ERROR:", err));
開發者ID:ashjd,項目名稱:hello,代碼行數:18,代碼來源:auth.service.ts


注:本文中的underscore.extend函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。