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

TypeScript lodash.defaults函数代码示例

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

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



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

示例1: constructor

  constructor($scope, $injector, $rootScope) {
    super($scope, $injector);
    this.$rootScope = $rootScope;

    _.defaults(this.panel, panelDefaults);
    _.defaults(this.panel.legend, panelDefaults.legend);

    this.events.on('data-received', this.onDataReceived.bind(this));
    this.events.on('data-error', this.onDataError.bind(this));
    this.events.on('data-snapshot-load', this.onDataReceived.bind(this));
    this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
  }
开发者ID:YuhangGe,项目名称:grafana,代码行数:12,代码来源:piechart_ctrl.ts


示例2: addModels

  function addModels(kiln) {
    extensionA = _.defaults({name: 'A'}, extensionApi)
    const extensionB = _.defaults({name: 'B'}, extensionApi)
    const extensionC = _.defaults({name: 'C'}, extensionApi)
    jest.spyOn(extensionA, 'build').mockReturnValue({resultA: 'foo'})
    jest.spyOn(extensionB, 'build').mockReturnValue({resultB: 'bar'})
    jest.spyOn(extensionC, 'build').mockReturnValue({resultC: 'baz'})

    kiln
      .addModel({name: 'user', model})
      .addExtension({modelName: 'user', extension: extensionA})
      .addExtension({modelName: 'user', extension: extensionB})
      .addModel({name: 'photo', model})
      .addExtension({modelName: 'photo', extension: extensionC})
  }
开发者ID:patrickhulce,项目名称:klay,代码行数:15,代码来源:kiln.test.ts


示例3: async

export const shipOrder = async (transactionId: string, orderLines?: Array<IMollieOrderLine>, tracking?: IMollieTracking): Promise<any> => {
  const [
    { default: store },
  ] = await Promise.all([
    import(/* webpackPrefetch: true, webpackChunkName: "transaction" */ '@transaction/store'),
  ]);
  try {
    const ajaxEndpoint = store.getState().config.ajaxEndpoint;

    const { data } = await axios.post(ajaxEndpoint, {
      resource: 'orders',
      action: 'ship',
      transactionId,
      orderLines,
      tracking,
    });
    if (!data.success && typeof data.message === 'string') {
      throw data.detailed ? data.detailed : data.message;
    }

    return defaults(data, { success: false, order: null });
  } catch (e) {
    if (typeof e === 'string') {
      throw e;
    }
    console.error(e);

    return false;
  }
};
开发者ID:mollie,项目名称:Prestashop,代码行数:30,代码来源:ajax.ts


示例4: constructor

	constructor(config: IConfig) {
		this._config = _.defaults({}, config, {
			request: axiosAdapter({
				forceHttpAdaptor: config.environment === 'node',
			}),
			userAgent: 'anx-api/' + packageJson.version,
			timeout: 60 * 1000,
			headers: {},
			target: null,
			token: null,
			rateLimiting: true,
			chunkSize: DEFAULT_CHUNK_SIZE,
		});

		this.request = __request;

		// Install optional rate limiting adapter
		this.request = this._config.rateLimiting ? rateLimitAdapter(_.assign({}, config, {
			request: __request.bind(this),
		})) : __request.bind(this);

		// Install optional concurrency adapter
		this._config.request = this._config.concurrencyLimit ? concurrencyAdapter({
			limit: this._config.concurrencyLimit,
			request: this._config.request,
		}) : this._config.request;
	}
开发者ID:appnexus,项目名称:anx-api,代码行数:27,代码来源:api.ts


示例5:

      .then(() => {
        _.each(datasources, (value, key) => {
          inputs.push(value);
        });

        // templatize constants
        for (let variable of saveModel.templating.list) {
          if (variable.type === 'constant') {
            var refName = 'VAR_' + variable.name.replace(' ', '_').toUpperCase();
            inputs.push({
              name: refName,
              type: 'constant',
              label: variable.label || variable.name,
              value: variable.current.value,
              description: '',
            });
            // update current and option
            variable.query = '${' + refName + '}';
            variable.options[0] = variable.current = {
              value: variable.query,
              text: variable.query,
            };
          }
        }

        // make inputs and requires a top thing
        var newObj = {};
        newObj['__inputs'] = inputs;
        newObj['__requires'] = _.sortBy(requires, ['id']);

        _.defaults(newObj, saveModel);
        return newObj;
      })
开发者ID:GPegel,项目名称:grafana,代码行数:33,代码来源:exporter.ts


示例6: test

    test('TCP/HTTP RPC command', function (done) {
      var server = new stratum.RPCServer(_.defaults({ mode: 'both' }, this.opts)),
        exposed = {
          'func': function (args, opts, callback) {
            callback(null, args)
          }
        },
        spy = sinon.spy(exposed, 'func'),
        client = new rpc.Client(server.opts.port, 'localhost')

      server.expose('func', exposed.func, exposed).listen()

      client.connectSocket(function (err, conn) {
        conn.call('func', ['MTIz', 1, 2], function (err, result) {
          expect(result).to.eql([1, 2])
          expect(spy.calledWith([1, 2])).to.equal(true)

          client.call('func', ['MTIz', 1, 2], function (err, result) {
            expect(result).to.eql([1, 2])
            expect(spy.calledWith([1, 2])).to.equal(true)
            server.close()
            done()
          })
        })
      })
    })
开发者ID:pocesar,项目名称:node-stratum,代码行数:26,代码来源:tests.ts


示例7: addParams

function addParams(request: PathFindRequest, result: RippledPathsResponse
): RippledPathsResponse {
  return _.defaults(_.assign({}, result, {
    source_account: request.source_account,
    source_currencies: request.source_currencies
  }), {destination_amount: request.destination_amount})
}
开发者ID:ripple,项目名称:ripple-lib,代码行数:7,代码来源:pathfind.ts


示例8: setDefaults

	private setDefaults(): void {
		this.config = _.defaults<Partial<RouteActiveConfig>, RouteActiveConfig>({
			activeClass: this.activeClass,
			attribute: this.attribute,
			matchExact: this.matchExact
		}, routeActiveConfig);
	}
开发者ID:sketch7,项目名称:ssv-au-core,代码行数:7,代码来源:route-active.attribute.ts


示例9: buildSassFile

function buildSassFile (srcFile, dstFile) {
  let sassOptions = _.defaults({ file: srcFile }, sassDefaults)
  return sassRender(sassOptions)
    .then((result) => {
      return writeFile(dstFile, result.css)
    })
}
开发者ID:ng-cookbook,项目名称:angular2-redux-complex-ui,代码行数:7,代码来源:build-css.ts


示例10: convertServerGroupCommandToDeployConfiguration

  public convertServerGroupCommandToDeployConfiguration(base: any): any {
    // use _.defaults to avoid copying the backingData, which is huge and expensive to copy over
    const command = defaults({ backingData: [], viewState: [] }, base);
    command.cloudProvider = 'aws';
    command.availabilityZones = {};
    command.availabilityZones[command.region] = base.availabilityZones;
    command.loadBalancers = (base.loadBalancers || []).concat(base.vpcLoadBalancers || []);
    command.targetGroups = base.targetGroups || [];
    command.account = command.credentials;
    command.subnetType = command.subnetType || '';

    if (base.viewState.mode !== 'clone') {
      delete command.source;
    }
    if (!command.ramdiskId) {
      delete command.ramdiskId; // TODO: clean up in kato? - should ignore if empty string
    }
    delete command.region;
    delete command.viewState;
    delete command.backingData;
    delete command.selectedProvider;
    delete command.instanceProfile;
    delete command.vpcId;

    return command;
  }
开发者ID:emjburns,项目名称:deck,代码行数:26,代码来源:serverGroup.transformer.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.defaultsDeep函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.defaultTo函数代码示例发布时间: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