Sha256: 8891f78af5e86737e1af1f1e5fce7307e7d6d9d55ed009d727e62f1f432dba6e

Contents?: true

Size: 241 Bytes

Versions: 396

Compression:

Stored size: 241 Bytes

Contents

module.exports = class Words
  constructor: (input) ->
    @words = input.toLowerCase().match(/\b[a-z0-9]+\b/g)

  count: ->
    counts = {}
    for word in @words
      counts[word] = if counts[word] then counts[word] + 1 else 1
    counts

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.138 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.137 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.136 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.135 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.134 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.133 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.132 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.131 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.130 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.129 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.128 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.127 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.126 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.125 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.124 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.123 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.122 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.121 tracks/coffeescript/exercises/word-count/example.coffee
trackler-2.2.1.120 tracks/coffeescript/exercises/word-count/example.coffee