soiz1's picture
Upload folder using huggingface_hub
4d70170 verified
raw
history blame
324 Bytes
export function flatten(items) {
return items.reduce((acc, item) => {
if (Array.isArray(item)) {
acc.push(...flatten(item))
}
else if (item) {
acc.push(item)
}
return acc
}, [])
}
export function returnError(cb: () => any) {
try {
return cb()
}
catch (e) {
return e
}
}