mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
make generateId public
This commit is contained in:
@@ -13,7 +13,7 @@ export class ChapmanTimedApiBasedParkingRepositoryLoader implements ParkingRepos
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
private normalizeAddress(address: string): string {
|
private static normalizeAddress(address: string): string {
|
||||||
return address
|
return address
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
@@ -21,12 +21,12 @@ export class ChapmanTimedApiBasedParkingRepositoryLoader implements ParkingRepos
|
|||||||
.join(' ');
|
.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
private generateId(address: string): string {
|
public static generateId(address: string): string {
|
||||||
const normalized = this.normalizeAddress(address);
|
const normalized = this.normalizeAddress(address);
|
||||||
const hash = createHash('sha256')
|
const hash = createHash('sha256')
|
||||||
.update(normalized)
|
.update(normalized)
|
||||||
.digest('hex');
|
.digest('hex');
|
||||||
|
|
||||||
return hash.substring(0, 12);
|
return hash.substring(0, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user