Created
December 17, 2019 12:17
-
-
Save nirsky/a7f9b54f3a879579c23ec3de4e23798c 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 | |
const fs = require('fs'); | |
export const handle = () => { | |
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