Commit b8331093 authored by Chris's avatar Chris

Update README.md

parent 87205692
# SetJS
A basic implementation of the `Set` data structure in Javascript. In case you don't know what a [set][1] is, I'll quote Wikipedia.
A basic implementation of the `Set` data structure in Javascript. In case you don't know what a `Set` is, I'll quote [Wikipedia][1].
> A set is an abstract data structure that can store certain values, without any particular order, and no repeated values.
......@@ -16,4 +16,36 @@ new BasicSet([initialData]);
var set = new BasicSet(1,'2',[2.5,'c'],'d',5.0); // {1,'2',2.5,'c','d',5.0}
```
### Methods
**BasicSet.prototype.add(args)**
<br>Appends all elements in `args` to the `BasicSet` object. `args` can be a value, several values, an array of values, or a mix of values and arrays of values. Returns the `BasicSet` object.
**BasicSet.prototype.remove(args)**
<br>Removes all elements in `args` from the `BasicSet` object. `args` can be a value, several values, an array of values, or a mix of values and arrays of values. Returns the `BasicSet` object.
**BasicSet.prototype.has(value)**
<br>Returns a boolean asserting whether an element is present with the given value in the `BasicSet` object or not.
**BasicSet.prototype.hasSome(args)**
<br>Returns a boolean asserting whether any of the elements in `args` are present in the `BasicSet` object. `args` can be a value, several values, an array of values, or a mix of values and arrays of values.
**BasicSet.prototype.hasAll(args)**
<br>Returns a boolean asserting whether all of the elements in `args` are present in the `BasicSet` object. `args` can be a value, several values, an array of values, or a mix of values and arrays of values.
**BasicSet.prototype.getAll()**
<br>Returns an Array containing every element in the `BasicSet` object.
**BasicSet.prototype.size()**
<br>Returns the number of elements in the `BasicSet` object.
**BasicSet.prototype.isEmpty()**
<br>Returns a boolean asserting whether the `BasicSet` object contains no elements.
**BasicSet.prototype.clear()**
<br>Removes all elements from the `BasicSet` object. Returns the `BasicSet` object.
**BasicSet.prototype.toString()**
<br>;Returns a String representation of the elements in the `BasicSet` object.
[1]: http://en.wikipedia.org/wiki/Set_(computer_science) "Set (abstract data type)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment