當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。