Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Apr 23, 2017
1 parent 3da01fc commit 352b33f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 5 additions & 4 deletions dist/naive-bayes.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,12 @@ var NaiveBayes = function () {
var classifier = new NaiveBayes(json.options);

// override the classifier's state
STATE_KEYS.forEach(function (k) {
if (!json[k]) {
throw new Error('NaiveBayes.fromJson: JSON string is missing an expected property: \'' + k + '\'.');
STATE_KEYS.forEach(function (key) {
if (json[key] == undefined) {
throw new Error('NaiveBayes.fromJson: JSON string is missing an expected property: \'' + key + '\'.');
} else {
classifier[key] = json[key];
}
classifier[k] = json[k];
});

return classifier;
Expand Down
9 changes: 5 additions & 4 deletions lib/naive-bayes.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,12 @@ class NaiveBayes {
const classifier = new NaiveBayes(json.options)

// override the classifier's state
STATE_KEYS.forEach(k => {
if (!json[k]) {
throw new Error(`NaiveBayes.fromJson: JSON string is missing an expected property: '${k}'.`)
STATE_KEYS.forEach(key => {
if (json[key] == undefined) {
throw new Error(`NaiveBayes.fromJson: JSON string is missing an expected property: '${key}'.`)
} else {
classifier[key] = json[key]
}
classifier[k] = json[k]
})

return classifier
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "naivebayes",
"version": "0.2.0",
"version": "0.3.0",
"description": "Naive Bayes Classifier for node.js.",
"main": "dist/naive-bayes.js",
"scripts": {
"dev": "nodemon --exec \"NODE_ENV=development node --harmony test.js\"",
"build": "babel lib --out-dir dist",
"test": "node test.js"
"test": "node test.js",
"deploy": "git push && npm publish && git push --tags"
},
"author": "Surmon",
"license": "MIT",
Expand Down

0 comments on commit 352b33f

Please sign in to comment.