Comparing version 1.0.0 to 1.0.1
@@ -6,2 +6,4 @@ function normalize (target) { | ||
return target | ||
if (typeof target.toHexString === 'function') | ||
return target.toHexString() | ||
if (typeof target.id != 'undefined') | ||
@@ -11,4 +13,2 @@ return target.id.toString() | ||
return target._id.toString() | ||
if (typeof target.toHexString === 'function') | ||
return target.toHexString() | ||
throw new Error('chaid could not get an id from ' + target) | ||
@@ -15,0 +15,0 @@ } |
{ | ||
"name": "chaid", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Id equality assertions for chai", | ||
@@ -29,3 +29,4 @@ "author": "Adam Hull <adam@hmlad.com>", | ||
"jshint": "*", | ||
"mocha": "~1.x.x" | ||
"mocha": "~1.x.x", | ||
"bson-objectid": "~1.0.1" | ||
}, | ||
@@ -32,0 +33,0 @@ "jshintConfig": { |
@@ -1,2 +0,2 @@ | ||
chaid | ||
chaId | ||
============== | ||
@@ -9,3 +9,4 @@ | ||
Chaid converts many different id representations to strings for comparison: | ||
Ids come in [lots of flavors](http://bites.goodeggs.com/posts/ids-in-mongoose-json-and-backbone/). Sometimes they're strings, sometimes objects. Sometimes you'll find them at `.id`, other times at `._id`. ChaId lets you test for equality by comparing string representations of ids, with minimal fretting about initial representation or location: | ||
```js | ||
@@ -12,0 +13,0 @@ {_id: 'foo'}.should.have.id('foo') |
4094
51
5