Skip to content

Commit

Permalink
Moved configurable stuff into Default
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Dec 4, 2015
1 parent 431b1d1 commit f7c3b26
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
17 changes: 1 addition & 16 deletions lib/Acho.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use strict'

chalk = require 'chalk'

DEFAULT = require './Default'
CONST = require './Constants'
format = require 'format-util'
existsAssign = require 'existential-assign'

module.exports = (options = {}) ->
Expand All @@ -29,18 +28,4 @@ module.exports = (options = {}) ->
@push type, message
this

acho.colorize = (colors, message) ->
return message if not @color or CONST.ENV is 'production'
colors = colors.split ' '
stylize = chalk
stylize = stylize[color] for color in colors
stylize message

acho.isPrintable = (type) ->
return true if @level is CONST.UNMUTED
return false if @level is CONST.MUTED
@types[type].level <= @types[@level].level

acho.format = (messages) -> format.apply null, messages

acho
20 changes: 18 additions & 2 deletions lib/Default.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
'use strict'

ms = require 'pretty-ms'
CONST = require './Constants'
chalk = require 'chalk'
ms = require 'pretty-ms'
CONST = require './Constants'
formatUtil = require 'format-util'

module.exports =
print: ->
Expand Down Expand Up @@ -43,6 +45,20 @@ module.exports =
@transport @generateMessage type, message
this

colorize: (colors, message) ->
return message if not @color or CONST.ENV is 'production'
colors = colors.split ' '
stylize = chalk
stylize = stylize[color] for color in colors
stylize message

isPrintable: (type) ->
return true if @level is CONST.UNMUTED
return false if @level is CONST.MUTED
@types[type].level <= @types[@level].level

format: (messages) -> formatUtil.apply null, messages

keyword: null
diff: false
align: true
Expand Down

0 comments on commit f7c3b26

Please sign in to comment.