Skip to content

Commit

Permalink
fix: Include lorem.json when publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
justinvdm committed Oct 5, 2023
1 parent 3b3e549 commit 4426410
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -20,6 +20,7 @@
"author": "Justin van der Merwe",
"license": "MIT",
"files": [
"data",
"*.js",
"utils/*.js",
"*.mjs",
Expand Down
10 changes: 5 additions & 5 deletions word.js
Expand Up @@ -4,7 +4,7 @@ var flip = require('./utils/flip')
var unicodify = require('./utils/unicodify')
var defaults = require('./utils/defaults')

var LETTERS = require('./lorem.json')
var SYLLABLES = require('./data/lorem.json')

var INT_RANGE = 4294967296

Expand All @@ -30,7 +30,7 @@ function word(input, opts) {
var candidates
var candidate
var candidatesLen
var candidateLetter
var candidateSyllable
var candidateProbability
var nextProbabilityMark
var syllableCount
Expand All @@ -46,20 +46,20 @@ function word(input, opts) {
probability = id / INT_RANGE

nextProbabilityMark = 0
candidates = LETTERS[prev]
candidates = SYLLABLES[prev]
candidatesLen = candidates.length
candidateIndex = -1
next = null

while (++candidateIndex < candidatesLen && next == null) {
candidate = candidates[candidateIndex]
candidateLetter = candidate[0]
candidateSyllable = candidate[0]
candidateProbability = candidate[1]

nextProbabilityMark += candidateProbability

if (probability <= nextProbabilityMark) {
next = candidateLetter
next = candidateSyllable
}
}

Expand Down

0 comments on commit 4426410

Please sign in to comment.