Permalink
Browse files

19: Renamed the library from persistent to immutable

Since this is a much better description of the project from
a wider audience.
  • Loading branch information...
1 parent 9217013 commit ccb90f7283a4b243e6035f55f91020a54d6bfbf2 @hughfdjackson committed Feb 28, 2013
Showing with 25 additions and 25 deletions.
  1. +20 −20 README.markdown
  2. +5 −5 package.json
  3. 0 src/{persistent.js → immutable.js}
View
@@ -1,8 +1,8 @@
**Warning: API Unstable (even more so than most < 1.0.0 releases)**
-# persistent
+# immutable
-persistent neatly packages immutable equivalents to JavaScript's Objects and Arrays.
+immutable neatly packages immutable equivalents to JavaScript's Objects and Arrays.
## Why?
@@ -11,16 +11,16 @@ Mutability causes headaches; immutability soothes them. JavaScript's Object and
## Support
-Current support is limited to ECMAScript 5 compliant environments; although ECMAScript 3 compliance [is a goal of this project](https://github.com/hughfdjackson/persistent/issues/7).
+Current support is limited to ECMAScript 5 compliant environments; although ECMAScript 3 compliance [is a goal of this project](https://github.com/hughfdjackson/immutable/issues/7).
-[![browser support](http://ci.testling.com/hughfdjackson/persistent.png)](http://ci.testling.com/hughfdjackson/persistent)
+[![browser support](http://ci.testling.com/hughfdjackson/immutable.png)](http://ci.testling.com/hughfdjackson/immutable)
## Example
```javascript
-var p = require('persistent'),
- person = p.object({ firstName: 'hugh', secondName: 'jackson' })
+var i = require('immutable'),
+ person = i.object({ firstName: 'hugh', secondName: 'jackson' })
var personWithAge = person.set({ age: 24 })
@@ -31,25 +31,25 @@ personWithAge.get('age') //= 24
## Install
-`npm install persistent`
+`npm install immutable`
-## persistent.object([Object]) -> object
+## immutable.object([Object]) -> object
Creates an empty object, or sets the attributes if an object is passed.
```javascript
-var o = p.object()
+var o = i.object()
// or
-var you = p.object({ wise: true, willUseThisLib: true })
+var you = i.object({ wise: true, willUseThisLib: true })
```
### .set(String, Value) OR .set(Object) -> object
Returns a new object with the additional attribute(s).
```javascript
-var o = p.object()
+var o = i.object()
var changed = o.set('x', 3).set({ y: 4, z: 5 })
@@ -62,7 +62,7 @@ changed.get('y') //= 4
Gets an attribute.
```javascript
-var o = p.object({ x: 3, y: 4 })
+var o = i.object({ x: 3, y: 4 })
o.get('x') //= 3
```
@@ -72,7 +72,7 @@ o.get('x') //= 3
Returns true or false; same as `key in object` for regular objects:
```javascript
-var o = p.object({ x: 3, y: 4 })
+var o = i.object({ x: 3, y: 4 })
o.has('x') //= true
o.has('z') //= false
@@ -83,7 +83,7 @@ o.has('z') //= false
Returns a new `object` with the key removed.
```javascript
-var o = p.object({
+var o = i.object({
foo: 'bar',
baz: 'quux'
})
@@ -98,7 +98,7 @@ o.has('foo') //= true
Returns a seperate, mutable object with the same attrs.
```javascript
-var o = p.object({
+var o = i.object({
foo: 'bar',
baz: 'quux'
})
@@ -109,16 +109,16 @@ delete trans.foo
o.has('foo') //= true
```
-## persistent.array(Array) -> array
+## immutable.array(Array) -> array
-Shares the same API as `persistent.object`, except:
+Shares the same API as `immutable.object`, except:
### .transient() -> Array
Returns a seperate, mutable array with the same attrs.
```javascript
-var arr1 = p.array([1, 2, 3]),
+var arr1 = i.array([1, 2, 3]),
arr2 = arr1.transient()
arr2.splice(1)
@@ -128,7 +128,7 @@ arr1[1] !== arr2[1] //= true
### Native Methods
-The following native methods return a new instance of p.array:
+The following native methods return a new instance of i.array:
* map
* sort
@@ -157,4 +157,4 @@ The following native methods work as expected for a regular array:
## Resources
-Based on [Bagwell (2001)](http://lampwww.epfl.ch/papers/idealhashtrees.pdf), and [Clojure's persistent implementation of a Hash Array Mapped Trie](https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java).
+Based on [Bagwell (2001)](http://lampwww.epfl.ch/papers/idealhashtrees.pdf), and [Clojure's immutable implementation of a Hash Array Mapped Trie](https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java).
View
@@ -1,14 +1,14 @@
{
- "name": "persistent",
- "description": "Persistent data-structures from the comfort of JavaScript - a lá clojure.",
+ "name": "immutable",
+ "description": "immutable data-structures in javascript.",
"version": "0.8.0-SNAPSHOT",
- "main": "src/persistent.js",
+ "main": "src/immutable.js",
"scripts": {
"test" : "node test/runner.js test/"
},
"repository": {
"type": "git",
- "url": "https://github.com/hughfdjackson/persistent.git"
+ "url": "https://github.com/hughfdjackson/immutable.git"
},
"dependencies": {
"string-hash": "1.1.0"
@@ -40,7 +40,7 @@
"keywords": [
"immutability",
"functional programming",
- "persistent datasctures"
+ "persistent datastructures"
],
"author": "hughfdjackson",
"license": "BSD"
File renamed without changes.

0 comments on commit ccb90f7

Please sign in to comment.