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

TypeScript extend类代码示例

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

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



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

示例1: callback

      (err, resp) => {
        if (err) {
          callback(err, null, null, resp);
          return;
        }

        let rows = [];

        if (resp.schema && resp.rows) {
          rows = this.bigQuery.mergeSchemaWithRows_(resp.schema, resp.rows);
        }

        let nextQuery = null;
        if (resp.jobComplete === false) {
          // Query is still running.
          nextQuery = extend({}, options);
        } else if (resp.pageToken) {
          // More results exist.
          nextQuery = extend({}, options, {
            pageToken: resp.pageToken,
          });
        }

        callback(null, rows, nextQuery, resp);
      }
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:25,代码来源:job.ts


示例2: extend

 issues.forEach((value) => {
   if (value.type === 'open') {
     issuesObject = extend(true, issuesObject, { 'open': value.total });
   }
   else {
     issuesObject = extend(true, issuesObject, { 'closed': value.total });
   }
 });
开发者ID:tarurar,项目名称:github-maturity,代码行数:8,代码来源:processRepo.ts


示例3: Env_to_Opts

export default function getPreset
	( env:WPACK.ENV
	, optionsFilename:string
	, type:"server"|"client"
	, isProd:boolean
	, returnWebpackConfig:boolean=false
	):WPACK.CONFIG | WEBPACK.CONFIG
	{
		const isServer = (type=='server');
		const defFlags = Env_to_Opts( env );
		const wpack_conf = Opts_to_WpackConf
			( extend
				( {}
				, defFlags
				,	{ bundleName:`${defFlags.bundleName}.${type}`
					, outputPath:isServer ? `${defFlags.outputPath}` : `${defFlags.outputPath}/public`
					, isServer
					, isProd
					}
				)
			, optionsFilename
			);

		return returnWebpackConfig ? buildConfig(wpack_conf) : wpack_conf;
	}
开发者ID:Xananax,项目名称:wpack,代码行数:25,代码来源:config.ts


示例4: function

BigQuery.prototype.dataset = function(id, options) {
  if (this.location) {
    options = extend({location: this.location}, options);
  }

  return new Dataset(this, id, options);
};
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:7,代码来源:index.ts


示例5: constructor

    constructor(options: any, edmx: Edm.Edmx) {
        options = options || {};

        this.options = extend({}, options)

        this.metadata = edmx
    }
开发者ID:jaystack,项目名称:odata-v4-service-document,代码行数:7,代码来源:JsonDocument.ts


示例6: it

    it('should not include fractional digits if not provided', function() {
      const input = extend({}, INPUT_OBJ);
      delete input.fractional;

      const time = bq.time(input);
      assert.strictEqual(time.value, '14:2:38');
    });
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:7,代码来源:index.ts


示例7: it

 it('should use the credentials field of the options object', done => {
   const options = extend(
     {},
     {
       projectId: 'fake-project',
       credentials: require('./fixtures/gcloud-credentials.json'),
     }
   );
   const debug = new Debug(options, packageInfo);
   const scope = nocks.oauth2(body => {
     assert.strictEqual(body.client_id, options.credentials.client_id);
     assert.strictEqual(body.client_secret, options.credentials.client_secret);
     assert.strictEqual(body.refresh_token, options.credentials.refresh_token);
     return true;
   });
   // Since we have to get an auth token, this always gets intercepted second.
   nocks.register(() => {
     scope.done();
     setImmediate(done);
     return true;
   });
   nocks.projectId('project-via-metadata');
   // TODO: Determine how to remove this cast.
   debuglet = new Debuglet(debug, (config as {}) as DebugAgentConfig);
   debuglet.start();
 });
开发者ID:GoogleCloudPlatform,项目名称:cloud-debug-nodejs,代码行数:26,代码来源:test-options-credentials.ts


示例8: it

    it('should by default error when workingDirectory is a root directory with a package.json', done => {
      const debug = new Debug({}, packageInfo);
      /*
       * `path.sep` represents a root directory on both Windows and Unix.
       * On Windows, `path.sep` resolves to the current drive.
       *
       * That is, after opening a command prompt in Windows, relative to the
       * drive C: and starting the Node REPL, the value of `path.sep`
       * represents `C:\\'.
       *
       * If `D:` is entered at the prompt to switch to the D: drive before
       * starting the Node REPL, `path.sep` represents `D:\\`.
       */
      const root = path.sep;
      const mockedDebuglet = proxyquire('../src/agent/debuglet', {
        /*
         * Mock the 'fs' module to verify that if the root directory is used,
         * and the root directory is reported to contain a `package.json`
         * file, then the agent still produces an `initError` when the
         * working directory is the root directory.
         */
        fs: {
          stat: (
            filepath: string | Buffer,
            cb: (err: Error | null, stats: {}) => void
          ) => {
            if (filepath === path.join(root, 'package.json')) {
              // The key point is that looking for `package.json` in the
              // root directory does not cause an error.
              return cb(null, {});
            }
            fs.stat(filepath, cb);
          },
        },
      });
      const config = extend({}, defaultConfig, {workingDirectory: root});
      const debuglet = new mockedDebuglet.Debuglet(debug, config);
      let text = '';
      debuglet.logger.error = (str: string) => {
        text += str;
      };

      debuglet.on('initError', (err: Error) => {
        const errorMessage =
          'The working directory is a root ' +
          'directory. Disabling to avoid a scan of the entire filesystem ' +
          'for JavaScript files. Use config `allowRootAsWorkingDirectory` ' +
          'if you really want to do this.';
        assert.ok(err);
        assert.strictEqual(err.message, errorMessage);
        assert.ok(text.includes(errorMessage));
        done();
      });

      debuglet.once('started', () => {
        assert.fail('Should not start if workingDirectory is a root directory');
      });

      debuglet.start();
    });
开发者ID:GoogleCloudPlatform,项目名称:cloud-debug-nodejs,代码行数:60,代码来源:test-debuglet.ts


示例9: extend

 createMethod: (id, options, callback) => {
   if (is.fn(options)) {
     callback = options;
     options = {};
   }
   options = extend({}, options, {location: this.location});
   return bigQuery.createDataset(id, options, callback);
 },
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:8,代码来源:dataset.ts


示例10: setMetadata

 setMetadata(metadata: Metadata, callback?: ResponseCallback):
     void|Promise<SetMetadataResponse> {
   // tslint:disable-next-line:no-any
   const protoOpts = (this.methods.setMetadata as any).protoOpts;
   const reqOpts =
       extend(true, {}, this.getOpts(this.methods.setMetadata), metadata);
   this.request(protoOpts, reqOpts, callback || util.noop);
 }
开发者ID:foggg7777,项目名称:nodejs-common-grpc,代码行数:8,代码来源:service-object.ts


示例11: table

  /**
   * Create a Table object.
   *
   * @param {string} id The ID of the table.
   * @param {object} [options] Table options.
   * @param {string} [options.location] The geographic location of the table, by
   *      default this value is inherited from the dataset. This can be used to
   *      configure the location of all jobs created through a table instance. It
   *      cannot be used to set the actual location of the table. This value will
   *      be superseded by any API responses containing location data for the
   *      table.
   * @return {Table}
   *
   * @example
   * const BigQuery = require('@google-cloud/bigquery');
   * const bigquery = new BigQuery();
   * const dataset = bigquery.dataset('institutions');
   *
   * const institutions = dataset.table('institution_data');
   */
  table(id, options) {
    options = extend(
      {
        location: this.location,
      },
      options
    );

    return new Table(this, id, options);
  };
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:30,代码来源:dataset.ts


示例12: it

    it('should optionally accept options', function(done) {
      const options = {a: 'b'};
      const expectedOptions = extend({location: undefined}, options);

      BIGQUERY.request = function(reqOpts) {
        assert.deepStrictEqual(reqOpts.qs, expectedOptions);
        done();
      };

      job.getQueryResults(options, assert.ifError);
    });
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:11,代码来源:job.ts


示例13: extend

export function getPluginsPrep
	( o:WPACK.CONFIG
	, extensions:string[]
	)
	{

		const 
			{ isProd
			, isServer
			, isDev
			, isClient
			, isDevServer
			, doCopyFiles
			, doCompileStyles
			} = o

		const USES_TYPESCRIPT = extensions.indexOf('ts')>=0;

		const copyConfig = doCopyFiles &&
			{ from: o.copyFiles.from
			, to:   o.copyFiles.to
			}; 

		const uglify = extend(true,{},uglifyDefaults,o.uglify);
		const extractText = extend(true,{},extractTextDefaults,o.extractText);

		return (
			{ isProd
			, isDevServer
			, isServer
			, isDev
			, isClient
			, doCompileStyles
			, USES_TYPESCRIPT
			, extractText
			, doCopyFiles
			, copyConfig
			}
		);
	}
开发者ID:Xananax,项目名称:wpack,代码行数:40,代码来源:plugins.ts


示例14: it

    it('should extend defaults with custom options object passed to constructor', () => {
      let expected = extend({}, defaultOptions, {
        trigger: [new Trigger('click')],
        text: 'hello world',
        placement: 'bottom'
      }); // copy

      expect(deepEqual((new Options({
        trigger: 'click',
        text: expected.text,
        placement: expected.placement
      })), expected)).toBe(true);
    });
开发者ID:dangsd,项目名称:popgun,代码行数:13,代码来源:Options.spec.ts


示例15: it

    it('should make the correct request', done => {
      const setMetadataMethod = grpcServiceObject.methods.setMetadata;
      const expectedReqOpts = extend(true, {}, DEFAULT_REQ_OPTS, METADATA);

      grpcServiceObject.methods.setMetadata.reqOpts = DEFAULT_REQ_OPTS;

      grpcServiceObject.request = (protoOpts, reqOpts, callback) => {
        assert.strictEqual(protoOpts, setMetadataMethod.protoOpts);
        assert.deepStrictEqual(reqOpts, expectedReqOpts);
        callback();  // done()
      };

      grpcServiceObject.setMetadata(METADATA, done);
    });
开发者ID:foggg7777,项目名称:nodejs-common-grpc,代码行数:14,代码来源:service-object.ts


示例16:

export default function buildDevServer
	( contentBase:string
	, port:number
	, conf:any
	):WEBPACK.DevServer
	{
		return makeDevServerOptions
			( extend
				( true
				, { contentBase, port }
				, conf
				)
			);
	}
开发者ID:Xananax,项目名称:wpack,代码行数:14,代码来源:devServer.ts


示例17: prepareResult

  // to do : fix this json manipulation (not good)
  private prepareResult(issues: IssuesCount[]): RepoItem {
    var issuesObject: any = {};
    issues.forEach((value) => {
      if (value.type === 'open') {
        issuesObject = extend(true, issuesObject, { 'open': value.total });
      }
      else {
        issuesObject = extend(true, issuesObject, { 'closed': value.total });
      }
    });
    issuesObject = { 'issues': issuesObject};

    return extend(true, this.item, issuesObject) as RepoItem;
  }
开发者ID:tarurar,项目名称:github-maturity,代码行数:15,代码来源:processRepo.ts


示例18: return

        return (config) => {
            if (ctxType) {
                var cfg = extend({
                    name: 'oData',
                    oDataServiceHost: this.options.url.replace('/$metadata', ''),
                    user: this.options.user,
                    password: this.options.password,
                    withCredentials: this.options.withCredentials,
                    maxDataServiceVersion: this.options.maxDataServiceVersion || '4.0'
                }, config)

                return new ctxType(cfg);
            } else {
                return null;
            }
        }
开发者ID:jpattersonz,项目名称:jaydata-dynamic-metadata,代码行数:16,代码来源:metadataHandler.ts


示例19: createQueryStream

  /**
   * Run a query scoped to your dataset as a readable object stream.
   *
   * See {@link BigQuery#createQueryStream} for full documentation of this
   * method.
   *
   * @param {object} options See {@link BigQuery#createQueryStream} for full
   *     documentation of this method.
   * @returns {stream}
   */
  createQueryStream(options) {
    if (is.string(options)) {
      options = {
        query: options,
      };
    }

    options = extend(true, {}, options, {
      defaultDataset: {
        datasetId: this.id,
      },
      location: this.location,
    });

    return this.bigQuery.createQueryStream(options);
  };
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:26,代码来源:dataset.ts


示例20: query

  /**
   * Run a query scoped to your dataset.
   *
   * See {@link BigQuery#query} for full documentation of this method.
   *
   * @param {object} options See {@link BigQuery#query} for full documentation of this method.
   * @param {function} [callback] See {@link BigQuery#query} for full documentation of this method.
   * @returns {Promise} See {@link BigQuery#query} for full documentation of this method.
   */
  query(options, callback) {
    if (is.string(options)) {
      options = {
        query: options,
      };
    }

    options = extend(true, {}, options, {
      defaultDataset: {
        datasetId: this.id,
      },
      location: this.location,
    });

    return this.bigQuery.query(options, callback);
  };
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:25,代码来源:dataset.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript fancy-log类代码示例发布时间:2022-05-28
下一篇:
TypeScript express-session类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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