Created
December 17, 2019 14:50
-
-
Save nirsky/f0eabfdea4df8a63a67983be6736f6ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node-handler.js | |
export const handle = () => { | |
eval('require')('fs').readFileSync(...); | |
... | |
}; | |
// browser-handler.js | |
export const handle = () => { ... }; | |
// index.js | |
const nodeHandler = require('./node-handler').handle; | |
const browserHandle = require('./browser-handler').handle; | |
const isNode = require('./config').isNode; | |
const handle = isNode ? nodeHandler : browserHandle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment