diff --git a/package.json b/package.json index b73c0ea..2d170ad 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/test/mocha.test.js b/test/mocha.test.js index a42f494..5f8544b 100644 --- a/test/mocha.test.js +++ b/test/mocha.test.js @@ -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) + }) }) })