Skip to content

Commit

Permalink
Fixed string type (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Jun 24, 2017
1 parent 4192872 commit b3f8393
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ coverage/
# A browser distribution is built in `dist` when pushing to npm.
dist/
# Code transpiled to ES5 is built in `lib` when pushing to npm.
lib/
lib/
package-lock.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.8.0",
"babel-cli": "^6.24.1",
"babel-istanbul": "^0.8.0",
"babel-loader": "^6.2.1",
"babel-plugin-transform-es2015-arrow-functions": "^6.8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class StringType extends Abstract {
}

typeCheck(value) {
if (utilities.isNumeric(value) || typeof value !== 'string') {
if (typeof value !== 'string') {
throw new Error()
}
return true
Expand Down
4 changes: 4 additions & 0 deletions test/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ describe('Types', () => {
assert.isTrue(type.test(BASE_FIELD, value))
done()
})

it('cast numbers presented as strings to strings', () => {
assert.equal(type.cast(BASE_FIELD, '001'), '001')
})
})

describe('IntegerType', () => {
Expand Down

0 comments on commit b3f8393

Please sign in to comment.