jobsuche-api-js
Version:
A JavaScript wrapper for the Arbeitsagentur jobs API, allowing developers to easily integrate job search functionality into their applications.
18 lines (17 loc) • 517 B
JavaScript
import { v4 as uuidv4 } from 'uuid';
function addUUID(obj) {
if (typeof obj !== 'object' || obj === null || Buffer.isBuffer(obj)) {
return obj;
}
if (Array.isArray(obj)) {
return obj.map(addUUID);
}
const newObj = Object.assign(Object.assign({}, obj), { uuid: uuidv4() });
for (const key in newObj) {
if (typeof newObj[key] === 'object' && newObj[key] !== null) {
newObj[key] = addUUID(newObj[key]);
}
}
return newObj;
}
export { addUUID };