Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
438 B
20 lines
438 B
// @flow strict-local
|
|
|
|
import crypto from 'crypto';
|
|
|
|
// $FlowFixMe
|
|
type Hashable = Object;
|
|
|
|
export default function objectHash(object: Hashable): string {
|
|
let hash = crypto.createHash('md5');
|
|
for (let key of Object.keys(object).sort()) {
|
|
let val = object[key];
|
|
if (typeof val === 'object' && val) {
|
|
hash.update(key + objectHash(val));
|
|
} else {
|
|
hash.update(key + val);
|
|
}
|
|
}
|
|
|
|
return hash.digest('hex');
|
|
}
|
|
|