refactor: convert more files to typescript (#16820)

This commit is contained in:
Samuel Attard 2019-02-12 06:22:33 -08:00 committed by John Kleinschmidt
parent cfbdc40814
commit 01c442de64
16 changed files with 169 additions and 90 deletions

View file

@ -0,0 +1,13 @@
export function atomBindingSetup (binding: typeof process['binding'], processType: typeof process['type']): typeof process['atomBinding'] {
return function atomBinding (name: string) {
try {
return binding(`atom_${processType}_${name}`)
} catch (error) {
if (/No such module/.test(error.message)) {
return binding(`atom_common_${name}`)
} else {
throw error
}
}
}
}