/
index.ts
23 lines (20 loc) · 897 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// spell-checker:ignore maint rivy
import { default as default_ } from './lib/OSPaths';
export * from './lib/OSPaths';
export default default_;
const haveModuleExports_ = typeof module === 'object' && module.exports;
// ## maint ~ [2020-12-23; rivy] although tested, `nyc` is unable to instrument ESM/.mjs correctly in order show coverage for testing the *else* clause
/* istanbul ignore else */
if (haveModuleExports_) {
// enables direct require from CJS (eg, `const module = require('...');`), but generally disables any other exports
// * skipped for ESM (missing `module.exports`)
// * added non-enumerable '_esm!' property (as a hack) to allow full access to all exports (for testing, ...)
// eslint-disable-next-line functional/immutable-data
module.exports = default_;
Object.defineProperty(module.exports, '_esm!', {
get() {
return exports;
},
enumerable: false,
});
}