12 lines
334 B
JavaScript

const removeNull = (obj) => Object.fromEntries(
Object.entries(obj)
.filter(([_, value]) => value != null)
.map(([key, value]) => [
key,
value === Object(value) ? removeNull(value) : value,
]),
)
const isAborted = (err) => err.name == 'AbortError'
export { removeNull, isAborted }