Skip to content

Instantly share code, notes, and snippets.

@DGZN
Last active June 13, 2022 00:48
Show Gist options
  • Save DGZN/e87c4ae4f8c0c4173231182e1be0e2b2 to your computer and use it in GitHub Desktop.
Save DGZN/e87c4ae4f8c0c4173231182e1be0e2b2 to your computer and use it in GitHub Desktop.
package.json repl script

.repl.js

/* Console logs function source code */
 global.viewsource = fnName => console.log(fnName+'')
 
 /* Console dir (like util.inspect) pass { depth: null } for unlimited levels of nesting */
 global.inspect = (...arguments) => console.dir(...arguments)

 /* Normalize file paths cross platform */
 global.require = path => require(require('path').normalize(path))

package.json

{
  "scripts": {
    "repl": "node -r ./.repl.js"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment