Skip to content

Commit

Permalink
Bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 7, 2015
1 parent dd52ee8 commit fd136e5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,16 @@ Returns the value for the specified *key* string. If the map does not have an en

<a name="map_set" href="#map_set">#</a> <i>map</i>.<b>set</b>(<i>key</i>, <i>value</i>)

Sets the *value* for the specified *key* string. If the map previously had an entry for the same *key* string, the old entry is replaced with the new value. Returns the map, allowing chaining.
Sets the *value* for the specified *key* string. If the map previously had an entry for the same *key* string, the old entry is replaced with the new value. Returns the map, allowing chaining. For example:

```js
var m = map()
.set("foo", 1)
.set("bar", 2)
.set("baz", 3);

m.get("foo"); // 1
```

<a name="map_remove" href="#map_remove">#</a> <i>map</i>.<b>remove</b>(<i>key</i>)

Expand Down Expand Up @@ -326,7 +335,16 @@ Returns true if and only if this set has an entry for the specified *value* stri

<a name="set_add" href="#set_add">#</a> <i>set</i>.<b>add</b>(<i>value</i>)

Adds the specified *value* string to this set. Returns the set, allowing chaining.
Adds the specified *value* string to this set. Returns the set, allowing chaining. For example:

```js
var s = set()
.add("foo")
.add("bar")
.add("baz");

s.has("foo"); // true
```

<a name="set_remove" href="#set_remove">#</a> <i>set</i>.<b>remove</b>(<i>value</i>)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-arrays",
"version": "0.2.1",
"version": "0.3.0",
"description": "Array manipulation, ordering, searching, summarizing, etc.",
"keywords": [
"d3",
Expand Down
23 changes: 6 additions & 17 deletions test/map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ tape("map.size() returns the number of distinct keys", function(test) {
});

tape("map.clear() removes all entries", function(test) {
var m = arrays.map();
m.set("foo", 1);
m.set("bar", 2);
m.set("foo", 3);
var m = arrays.map().set("foo", 1).set("bar", 2).set("foo", 3);
test.equal(m.size(), 2);
m.clear();
test.equal(m.size(), 0);
test.deepEqual(m.entries(), []);
Expand Down Expand Up @@ -159,9 +157,7 @@ tape("map.keys() returns an array of string keys", function(test) {
});

tape("map.keys() properly unescapes zero-prefixed keys", function(test) {
var m = arrays.map();
m.set("__proto__", 42);
m.set("$weird", 42);
var m = arrays.map().set("__proto__", 42).set("$weird", 42);
test.deepEqual(m.keys().sort(), ["$weird", "__proto__"]);
test.end();
});
Expand Down Expand Up @@ -222,17 +218,13 @@ tape("map.has(key) empty maps do not have object built-ins", function(test) {
});

tape("map.has(key) can has keys using built-in names", function(test) {
var m = arrays.map();
m.set("__proto__", 42);
var m = arrays.map().set("__proto__", 42);
test.equal(m.has("__proto__"), true);
test.end();
});

tape("map.has(key) can has keys with null or undefined properties", function(test) {
var m = arrays.map();
m.set("", "");
m.set("null", null);
m.set("undefined", undefined);
var m = arrays.map().set("", "").set("null", null).set("undefined", undefined);
test.equal(m.has(""), true);
test.equal(m.has("null"), true);
test.equal(m.has("undefined"), true);
Expand Down Expand Up @@ -348,10 +340,7 @@ tape("map.set(key, value) can replace values", function(test) {
});

tape("map.set(key, value) can set null, undefined or empty string values", function(test) {
var m = arrays.map();
m.set("", "");
m.set("null", null);
m.set("undefined", undefined);
var m = arrays.map().set("", "").set("null", null).set("undefined", undefined);
test.equal(m.get(""), "");
test.equal(m.get("null"), null);
test.equal(m.get("undefined"), undefined);
Expand Down
17 changes: 5 additions & 12 deletions test/set-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ tape("set.size() returns the number of distinct values", function(test) {
});

tape("set.clear() removes all values", function(test) {
var s = arrays.set();
s.add("foo");
s.add("bar");
s.add("foo");
var s = arrays.set().add("foo").add("bar").add("foo");
test.equal(s.size(), 2);
s.clear();
test.equal(s.size(), 0);
test.deepEqual(s.values(), []);
Expand Down Expand Up @@ -202,15 +200,13 @@ tape("set.add(value) returns the set", function(test) {
});

tape("set.add(value) can add values using built-in names", function(test) {
var s = arrays.set();
s.add("__proto__");
var s = arrays.set().add("__proto__");
test.equal(s.has("__proto__"), true);
test.end();
});

tape("set.add(value) can add values using zero-prefixed names", function(test) {
var s = arrays.set();
s.add("$weird");
var s = arrays.set().add("$weird");
test.equal(s.has("$weird"), true);
test.end();
});
Expand All @@ -228,10 +224,7 @@ tape("set.add(value) coerces values to strings", function(test) {
});

tape("set.add(value) can add null, undefined or empty string values", function(test) {
var s = arrays.set();
s.add("");
s.add("null");
s.add("undefined");
var s = arrays.set().add("").add("null").add("undefined");
test.equal(s.has(""), true);
test.equal(s.has("null"), true);
test.equal(s.has("undefined"), true);
Expand Down

0 comments on commit fd136e5

Please sign in to comment.