Permalink
Browse files

added .delete alias for .remove

  • Loading branch information...
1 parent 0c09789 commit 656bb707b6f180811686213d48a4f39447353e5b @hughfdjackson committed Dec 28, 2012
Showing with 11 additions and 4 deletions.
  1. +2 −2 README.markdown
  2. +1 −1 package.json
  3. +3 −0 src/true-map.js
  4. +5 −1 test/true-map-test.js
View
@@ -69,9 +69,9 @@ o.has('x') //= true
o.has('z') //= false
```
-### .remove(String)
+### .remove(String) `alias: .delete(String)`
-Removes an attribute - same as delete, but it returns the map itself to allow chaining (there are no non-deletable attributes, so returning `true` or `false` is unnecessary)
+Removes an attribute - same as the `delete` keyword, but it returns the map itself to allow chaining (there are no non-deletable attributes, so returning `true` or `false` is unnecessary)
```
var o = map({
View
@@ -1,7 +1,7 @@
{
"name": "true-map",
"description": "A string:val map that works for all keynames - including __proto__",
- "version": "0.1.1",
+ "version": "0.2.0",
"main": "src/true-map.js",
"scripts": {
"test": "mocha --ui qunit"
View
@@ -26,6 +26,9 @@ void function(root){
}
}
+ // alias remove
+ map.prototype['delete'] = map.prototype.remove
+
if ( typeof module == 'object' && module.exports ) module.exports = map
else root['trueMap'] = map
View
@@ -88,6 +88,10 @@ test('map.remove returns `this`', function(){
var o = map()
o.set('foo', 'bar')
-
a.equal(o.remove('foo').remove('pretend'), o)
})
+
+test('map.delete is an alias of map.remove', function(){
+ var o = map()
+ a.equal(o['delete'], o.remove)
+})

0 comments on commit 656bb70

Please sign in to comment.