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


TypeScript node-uuid.v1函数代码示例

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


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

示例1: setVisitorInfo

  setVisitorInfo() {
    const visitorId = this._config.visitorId
      || Cookies.get(VISITOR_COOKIE_KEY)
      || uuid.v1();
    const sessionId = this._config.sessionId
      || Cookies.get(SESSION_COOKIE_KEY)
      || uuid.v1();

    this.setVisitor(visitorId, sessionId);
  }
开发者ID:groupby,项目名称:searchandiser-ui,代码行数:10,代码来源:tracker.ts

示例2: it

  it('v1', () => {
    const result: string = v1(null, null, 10);
    expect(result).to.be.a('string');

    const array: number[] = v1(null, []);
    expect(array).to.be.an('array');

    const buffer: Buffer = v1(null, new Buffer(''));
    expect(buffer).to.be.an.instanceOf(Buffer);
  });
开发者ID:goodmind,项目名称:typed-node-uuid,代码行数:10,代码来源:index.ts

示例3: function

            function (item, done) {
                var pluginPath = path.join(folder, item);
                ctx.info('inspecting ' + pluginPath);
                if (path.extname(pluginPath) === '.js') {
                    try {
                        var plugin = require(pluginPath);

                        // ensure plugin - has name and title functions
                        if (isFunction(plugin.pluginName) && isFunction(plugin.pluginTitle)) {
                            ctx.info('Found plugin: ' + plugin.pluginName() + ' @ ' + pluginPath);

                            if (isFunction(plugin.beforeJob)) {
                                plugin.beforeId = uuid.v1();
                                plugins['beforeJob'].push(plugin);
                            }

                            // one plugin may have implementations of multiple options
                            if (isFunction(plugin.afterJobPlugins)) {
                                plugin.afterJobPlugins(jobContext).forEach((option: IPlugin) => {
                                    option.afterId = uuid.v1();
                                    plugins['afterJob'].push(option);
                                });
                            }
                        }
                    }
                    catch (ex) {
                        console.error(ex);
                    }
                }

                done();
            },
开发者ID:itsananderson,项目名称:vso-agent,代码行数:32,代码来源:plugins.ts

示例4: function

    socket.on("player_joined", function () {
        let uuid = UUID.v1();
        x = Math.floor(Math.random() * (7));
        y = Math.floor(Math.random() * (7));

        console.log("New Player " + uuid + " at X:" + x + ", Y:" + y);

        let player = {
            x: x,
            y: y,
            uuid: uuid,
            type: "human"
        };

        socket.emit("new_player", player);
        socket.broadcast.emit("new_entity", player);

        for (let uuid in entities) {
            let entity = entities[uuid];
            socket.emit("new_entity", entity);
        }

        entities[uuid] = player;
        players[socket.id] = uuid;
    });
开发者ID:CWDN,项目名称:battle-monsters,代码行数:25,代码来源:boot.ts

示例5: generateResponseFile

function generateResponseFile(): Q.Promise<string> {
    var startTime = perf();
    var endTime : number;
    var elapsedTime : number;
    var defer = Q.defer<string>();
    var tempFile = path.join(os.tmpdir(), uuid.v1() + ".txt");
    tl.debug("Response file will be generated at " + tempFile);
    var selectortool = tl.createToolRunner(getTestSelectorLocation());
    selectortool.arg("GetImpactedtests");
    selectortool.arg("/TfsTeamProjectCollection:" + tl.getVariable("System.TeamFoundationCollectionUri"));
    selectortool.arg("/ProjectId:" + tl.getVariable("System.TeamProject"));
    selectortool.arg("/buildid:" + tl.getVariable("Build.BuildId"));
    selectortool.arg("/token:" + tl.getEndpointAuthorizationParameter("SystemVssConnection", "AccessToken", false));
    selectortool.arg("/responsefile:" + tempFile);
    selectortool.exec()
        .then(function (code) {
            endTime = perf();
            elapsedTime = endTime - startTime;
            tl._writeLine("##vso[task.logissue type=warning;SubTaskName=GenerateResponseFile;SubTaskDuration=" + elapsedTime + "]");    
            tl.debug(tl.loc("GenerateResponseFilePerfTime", elapsedTime));
            defer.resolve(tempFile);
        })
        .fail(function (err) {
            defer.reject(err);
        });

    return defer.promise;
}
开发者ID:ColinDabritz,项目名称:vsts-tasks,代码行数:28,代码来源:vstest.ts

示例6: HttpError

    var promises = files.map((file)=> {
      var guid
      if (body.info) {
        var info = JSON.parse(body.info)
        if (info.guid) {
          if (!info.guid.match(/[\w\-]+/))
            throw new HttpError('Invalid guid: ' + info.guid + '.', 400)

          guid = info.guid
        }
      }

      guid = guid || uuid.v1()

      var path = require('path')
      var ext = path.extname(file.originalname) || ''
      var filename = guid + ext
      var filepath = (this.config.paths.files) + '/' + filename
      var fs = require('fs')
      fs.rename(file.path, filepath);

      // !!! Add check if file already exists
      return this.ground.update_object('file', {
        guid: guid,
        name: filename,
        path: file.path,
        size: file.size,
        extension: ext.substring(1),
        status: 1
      }, user)
    })
开发者ID:silentorb,项目名称:vineyard-cellar,代码行数:31,代码来源:cellar.ts

示例7: createStory

export function createStory(title: string, user: User) {
  return {
    type: CREATE_STORY,
    id: uuid.v1(),
    title,
    user,
  };
}
开发者ID:radmen,项目名称:storywrap,代码行数:8,代码来源:createStory.ts

示例8: getvsTestConfigurations

export function getvsTestConfigurations() {
    const vsTestConfiguration = {} as models.VsTestConfigurations;
    initTestConfigurations(vsTestConfiguration);
    vsTestConfiguration.publishRunAttachments = tl.getInput('publishRunAttachments');
    vsTestConfiguration.vstestDiagFile = path.join(os.tmpdir(), uuid.v1() + '.txt');
    vsTestConfiguration.ignoreVstestFailure = tl.getVariable('vstest.ignoretestfailures');
    return vsTestConfiguration;
}
开发者ID:colindembovsky,项目名称:vsts-tasks,代码行数:8,代码来源:taskinputparser.ts

示例9: generateInline

export function generateInline(source: string, extension = '.ts') {
    let tmpDir = path.join(process.cwd(), 'tmp');
    rmDir(tmpDir);
    let tmpPath = path.join(tmpDir, uuid.v1() + extension);
    fs.writeFileSync(tmpPath, source);

    return generateModule(tmpPath, 'docscript');
}
开发者ID:blink1073,项目名称:docscript,代码行数:8,代码来源:utils.ts

示例10: setName

export function setName(name: string) {
  const id = uuid.v1();

  return {
    type: SET_NAME,
    name,
    id,
  };
}
开发者ID:radmen,项目名称:storywrap,代码行数:9,代码来源:setName.ts


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