Skip to content

Commit

Permalink
Improve module hierarchy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoichi-obara committed Oct 26, 2017
1 parent 89aa427 commit b738af2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
23 changes: 9 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@

const SUFFIX = '=?';

function studyMarking201709() {

this.isAvailable = function(message) {
var found = message.lastIndexOf(SUFFIX);
return (found != -1 && found == message.length - SUFFIX.length);
}

this.extract = function(message) {
return message.substr(0, message.length - SUFFIX.length);
}
module.exports.isAvailable = function(message) {
var found = message.lastIndexOf(SUFFIX);
return (found != -1 && found == message.length - SUFFIX.length);
}

this.evalExpression = function(message) {
return eval(message);
}
module.exports.extract = function(message) {
return message.substr(0, message.length - SUFFIX.length);
}

module.exports = studyMarking201709;
module.exports.evalExpression = function(message) {
return eval(message);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "study-marking-201709",
"version": "1.0.0",
"version": "1.0.1",
"description": "study-marking-201709",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 1 addition & 3 deletions test/test-index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import test from 'ava'
import studyMarking201709 from '../index'

const sm = new studyMarking201709();
import sm from '../index'

// ----------------------------------------
// isAvailable
Expand Down

0 comments on commit b738af2

Please sign in to comment.