Skip to content

Commit

Permalink
refactor!: convert to ESM, simplify partial calls
Browse files Browse the repository at this point in the history
  • Loading branch information
foxxyz committed Oct 29, 2023
1 parent bae5e94 commit 02835b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
26 changes: 7 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,12 @@ console.warn = colored.bind(this, console.warn, YELLOW)
console.error = colored.bind(this, console.error, RED)

console.part = {
debug(...args) {
stdout.write(`${GREY}${args.join(' ')}${DEFAULT}`)
},
error(...args) {
stdout.write(`${RED}${args.join(' ')}${DEFAULT}`)
},
log(...args) {
stdout.write(args.join(' '))
},
info(...args) {
stdout.write(`${BLUE}${args.join(' ')}${DEFAULT}`)
},
success(...args) {
stdout.write(`${GREEN}${args.join(' ')}${DEFAULT}`)
},
warn(...args) {
stdout.write(`${YELLOW}${args.join(' ')}${DEFAULT}`)
}
debug: colored.bind(stdout, stdout.write, GREY),
error: colored.bind(stdout, stdout.write, RED),
log: colored.bind(stdout, stdout.write, DEFAULT),
info: colored.bind(stdout, stdout.write, BLUE),
success: colored.bind(stdout, stdout.write, GREEN),
warn: colored.bind(stdout, stdout.write, YELLOW),
}

module.exports = console
export default console
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"lint": "eslint .",
"test": "node ./test.js"
},
"type": "module",
"files": [
"index.js"
],
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

require('.')
import './index.js'

console.debug('👀 For developers only')
console.log('🙈 Don\'t pay attention to me')
Expand Down

0 comments on commit 02835b4

Please sign in to comment.