Skip to content

Instantly share code, notes, and snippets.

@NovoManu
Last active March 15, 2021 07:53
Show Gist options
  • Save NovoManu/74b0a0866a2b72fb81fd4099dd4b0f2e to your computer and use it in GitHub Desktop.
Save NovoManu/74b0a0866a2b72fb81fd4099dd4b0f2e to your computer and use it in GitHub Desktop.
// lib.js
export const PI = Math.PI
const sum = (a, b) => a + b
export default sum
// file.js
import sum, { PI } from 'lib.js'
console.log(sum(1, PI)) // Expected output: 4.141592654
// lib2.js
export * from 'lib.js'
export const e = Math.E
export const ln = x => Math.log(x)
//file2.js
import * as ma from 'lib2.js'
console.log(ma.ln(ma.e)) // Expected output: 1
console.log(sum(1, PI)) // Expected output: 4.141592654
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment