Skip to content

Commit

Permalink
Use lodash instead of the deprecated utila
Browse files Browse the repository at this point in the history
  • Loading branch information
AriaMinaei committed Oct 18, 2020
1 parent 60b6770 commit eead093
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 81 deletions.
111 changes: 58 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"css-select": "^1.1.0",
"dom-converter": "^0.2",
"htmlparser2": "^3.3.0",
"strip-ansi": "^3.0.0",
"utila": "^0.4.0"
"lodash": "^4.17.20",
"strip-ansi": "^3.0.0"
},
"devDependencies": {
"chai": "^4.1.2",
Expand Down
1 change: 0 additions & 1 deletion src/AnsiPainter.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
tools = require './tools'
tags = require './ansiPainter/tags'
styles = require './ansiPainter/styles'
{object} = require 'utila'

module.exports = class AnsiPainter
@tags: tags
Expand Down
6 changes: 3 additions & 3 deletions src/Layout.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Block = require './layout/Block'
{object} = require 'utila'
{cloneAndMergeDeep} = require './tools'
SpecialString = require './layout/SpecialString'
terminalWidth = require('./tools').getCols()

Expand All @@ -18,10 +18,10 @@ module.exports = class Layout
constructor: (config = {}, rootBlockConfig = {}) ->
@_written = []
@_activeBlock = null
@_config = object.append self._defaultConfig, config
@_config = cloneAndMergeDeep self._defaultConfig, config

# Every layout has a root block
rootConfig = object.append self._rootBlockDefaultConfig, rootBlockConfig
rootConfig = cloneAndMergeDeep self._rootBlockDefaultConfig, rootBlockConfig
@_root = new Block @, null, rootConfig, '__root'
@_root._open()

Expand Down
7 changes: 4 additions & 3 deletions src/RenderKid.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
inlineStyleApplier = require './renderKid/styleApplier/inline'
blockStyleApplier = require './renderKid/styleApplier/block'
isPlainObject = require 'lodash/isPlainObject'
{cloneAndMergeDeep} = require './tools'
AnsiPainter = require './AnsiPainter'
Styles = require './renderKid/Styles'
Layout = require './Layout'
tools = require './tools'
{object} = require 'utila'
stripAnsi = require 'strip-ansi'
terminalWidth = require('./tools').getCols()

Expand All @@ -19,7 +20,7 @@ module.exports = class RenderKid

constructor: (config = {}) ->
@tools = self.tools
@_config = object.append self._defaultConfig, config
@_config = cloneAndMergeDeep self._defaultConfig, config
do @_initStyles

_initStyles: ->
Expand All @@ -37,7 +38,7 @@ module.exports = class RenderKid
_toDom: (input) ->
if typeof input is 'string'
@_parse input
else if object.isBareObject(input) or Array.isArray(input)
else if isPlainObject(input) or Array.isArray(input)
@_objToDom input
else
throw Error "Invalid input type. Only strings, arrays and objects are accepted"
Expand Down
4 changes: 2 additions & 2 deletions src/layout/Block.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SpecialString = require './SpecialString'
{object} = require 'utila'
terminalWidth = require('../tools').getCols()
{cloneAndMergeDeep} = require '../tools'

module.exports = class Block
self = @
Expand Down Expand Up @@ -32,7 +32,7 @@ module.exports = class Block
suffixRaw: ''

constructor: (@_layout, @_parent, config = {}, @_name = '') ->
@_config = object.append self.defaultConfig, config
@_config = cloneAndMergeDeep self.defaultConfig, config
@_closed = no
@_wasOpenOnce = no
@_active = no
Expand Down
Loading

0 comments on commit eead093

Please sign in to comment.