1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

convert appid service to ts

This commit is contained in:
Kyle Spearrin
2017-11-02 15:51:05 -04:00
parent 8eeb5821f0
commit 5fd850929d
4 changed files with 43 additions and 3 deletions

View File

@@ -8,6 +8,15 @@ const AnalyticsIds = {
};
export default class UtilsService {
// ref: http://stackoverflow.com/a/2117523/1090359
static newGuid(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
static extendObject(...objects: any[]): any {
for (let i = 1; i < objects.length; i++) {
for (const key in objects[i]) {