Skip to content

Commit

Permalink
Updated version & added test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenPioneer committed Apr 10, 2017
1 parent c32c185 commit f66d218
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auto-parse",
"version": "1.2.0",
"version": "1.3.0",
"description": "auto-parse any value you happen to send in (String, Number, Boolean,Array, Object, Function, undefined and null). You send it we will try to find a way to parse it.support sending in a string of what type (e.g. boolean) or constructor (e.g. Boolean)",
"main": "index.js",
"dependencies": {
Expand Down
7 changes: 7 additions & 0 deletions test/mocha.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,12 @@ describe('Auto Parse', function () {
assert.equal(autoParse('1', 'Null'), null)
assert.equal(autoParse('0', 'Null'), null)
})
it('same type to same type', function () {
assert.deepEqual(autoParse([42], Array), [42])
assert.deepEqual(autoParse({name: 'greenpioneer'}, Object), {name: 'greenpioneer'})
assert.equal(autoParse(true, Boolean), true)
assert.equal(autoParse('test', String), 'test')
assert.equal(autoParse(1234, Number), 1234)
})
})
})

0 comments on commit f66d218

Please sign in to comment.