Created
December 17, 2019 14:36
-
-
Save nirsky/eb1b39631a2243a1ea04e5b3a4696302 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 = () => { | |
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