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


TypeScript underscore.clone函数代码示例

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


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

示例1: createCompile

function createCompile(build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
	const opts = _.clone(options);
	opts.inlineSources = !!build;
	opts.noFilesystemLookup = true;

	const ts = tsb.create(opts, null, null, err => reporter(err.toString()));

	return function (token?: util.ICancellationToken) {
		const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
		const tsFilter = util.filter(data => /\.ts$/.test(data.path));
		const noDeclarationsFilter = util.filter(data => !(/\.d\.ts$/.test(data.path)));

		const input = es.through();
		const output = input
			.pipe(utf8Filter)
			.pipe(bom())
			.pipe(utf8Filter.restore)
			.pipe(tsFilter)
			.pipe(util.loadSourcemaps())
			.pipe(ts(token))
			.pipe(noDeclarationsFilter)
			.pipe(build ? nls() : es.through())
			.pipe(noDeclarationsFilter.restore)
			.pipe(sourcemaps.write('.', {
				addComment: false,
				includeContent: !!build,
				sourceRoot: options.sourceRoot
			}))
			.pipe(tsFilter.restore)
			.pipe(reporter.end(emitError));

		return es.duplex(input, output);
	};
}
开发者ID:diarmaidm,项目名称:vscode,代码行数:34,代码来源:compilation.ts

示例2: MonitoredItemModifyRequest

 const itemsToModify = monitoredItems.map((monitoredItem: ClientMonitoredItemBase) => {
     const clientHandle = monitoredItem.monitoringParameters.clientHandle;
     return new MonitoredItemModifyRequest({
         monitoredItemId: monitoredItem.monitoredItemId,
         requestedParameters: _.extend(_.clone(parameters), {clientHandle})
     });
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:7,代码来源:client_monitored_item_toolbox.ts

示例3: function

util.isMathDeviceCodeResponse = function (expected: any, received: any, print: any) {
  if (print) {
    console.log('DIFFS');
    util.findDiffs(expected, received);
    console.log('EXPECTED');
    console.log(expected);
    console.log('RECEIVED');
    console.log(received);
  }

  var receivedClone = _.clone(received);
  var expectedClone = _.clone(expected);

  var isEqual = _.isEqual(expectedClone, receivedClone);

  return isEqual;
};
开发者ID:AzureAD,项目名称:azure-activedirectory-library-for-nodejs,代码行数:17,代码来源:util.ts

示例4: init

    init(files, app) {
        this.services = files.services;
        this.hasId = false;
        this.schema = _.clone(STATS_SCHEMA);

        for (let i in this.schema) {
            this.schema[i] = this.getSchemaType(this.schema[i]);
        }
    }
开发者ID:Tzook,项目名称:lul,代码行数:9,代码来源:stats.model.ts

示例5: addFieldToModel

    protected addFieldToModel(field, data, obj: Char, reqBody) {
        const statsSchema: any = _.clone(STATS_SCHEMA);

        statsSchema.hp.now = statsSchema.hp.total = 20;
        statsSchema.mp.now = statsSchema.mp.total = 20;

        obj[field] = statsSchema;
		this.addFields(obj, reqBody);
    }
开发者ID:Tzook,项目名称:lul,代码行数:9,代码来源:stats.model.ts

示例6: getRemoteBlock

 // Get block of given peer with given block number
 async getRemoteBlock(bc:any, number:number) {
   let block = bc[number] || null;
   // Quantum block implementation
   if (block && block.quantum) {
     bc[number] = _.clone(block);
     bc[number].hash = 'Q' + block.hash;
   }
   return block;
 }
开发者ID:duniter,项目名称:duniter,代码行数:10,代码来源:block_pulling.ts

示例7: function

 function(callback: any) {
   var resource = responses[count].resource;
   var clientId = responses[count].clientId;
   var cacheDriver = new CacheDriver(fakeTokenRequest._callContext, authority, resource, clientId, memCache, unexpectedRefreshFunction);
   var responseToAdd = _.clone(responses[count].decodedResponse);
   cacheDriver.add(responseToAdd, function(err: any) {
     count++;
     process.nextTick(function() {
       callback(err);
       return;
     });
   });
 },
开发者ID:AzureAD,项目名称:azure-activedirectory-library-for-nodejs,代码行数:13,代码来源:cache-driver.ts

示例8: compareInputAndCache

  /*
   * Compares two lists of cache entries.  The lists will be sorted before comparison and the comparison will
   * take in to account the different ways that MRRT is indicated when a cache entry is submitted to the cache
   * and once it is in the cache.
   */
  function compareInputAndCache(input: any, cache: any, numMRRTTokens: any, mrrtRefreshToken?: any) {
    var foundNumMRRTTokens = 0;
    var cacheEntries = cache._entries;
    var authority = cp.authorityTenant;
    var userId = cp.username;

    assert(input.length === cacheEntries.length, 'Input responses and cache entries lengths are not the same: ' + input.length + ',' + cacheEntries.length);

    input = _.sortBy(input, 'accessToken');
    cacheEntries = _.sortBy(cacheEntries, 'accessToken');

    for (var j = 0; j < cacheEntries.length; j++) {
      var expected = _.clone(input[j]);
      var received = _.clone(cacheEntries[j]);

      if (received.isMRRT) {
        foundNumMRRTTokens++;
        if (received._authority === authority && received.userId === userId) {
          // Everything should match except the refresh token.  We will check that below.
          delete expected['refreshToken'];
          delete received['refreshToken'];
        }
      }
      assertEntriesEqual(expected, received, 'Found a modified entry number ' + j);
    }

    if (numMRRTTokens) {
      assert(numMRRTTokens === foundNumMRRTTokens, 'Found wrong number of MRRT tokens in the cache: ' + numMRRTTokens + ',' + foundNumMRRTTokens);

      // Ensure that when the last refresh token was added that all mrrt refresh tokens were updated to contain that same
      // refresh token.
      for (var i = 0; i < cacheEntries[i].length; i++) {
        if (cacheEntries[i].isMRRT) {
          assert(cacheEntries[i]['refreshToken'] === mrrtRefreshToken, 'One of the responses refresh token was not correctly updated: ' + i);
        }
      }
    }
  }
开发者ID:AzureAD,项目名称:azure-activedirectory-library-for-nodejs,代码行数:43,代码来源:cache-driver.ts

示例9: launch

 // launch a command and detach -- used to start x11 applications running.
 launch(command: string, args?: string[]): void {
   const env = clone(process.env);
   env.DISPLAY = `:${this.display}`;
   const cwd = this.get_cwd();
   const options: SpawnOptions = { cwd, env, detached: true, stdio: "ignore" };
   args = args != null ? args : [];
   try {
     const sub = spawn(command, args, options);
     sub.unref();
   } catch (err) {
     this.channel.write({
       error: `error launching ${command} -- ${err}`
     });
     return;
   }
 }
开发者ID:DrXyzzy,项目名称:smc,代码行数:17,代码来源:server.ts


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