本文整理汇总了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);
}
示例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);
});
示例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();
},
示例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;
});
示例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;
}
示例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)
})
示例7: createStory
export function createStory(title: string, user: User) {
return {
type: CREATE_STORY,
id: uuid.v1(),
title,
user,
};
}
示例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;
}
示例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');
}
示例10: setName
export function setName(name: string) {
const id = uuid.v1();
return {
type: SET_NAME,
name,
id,
};
}