immutable
Advanced tools
Comparing version 1.4.0 to 1.4.1
{ | ||
"name": "immutable", | ||
"description": "efficient immutable data-structures in javascript.", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"main": "src/immutable.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
'use strict' | ||
module.exports = { | ||
object: require('./object'), | ||
obj: require('./object'), | ||
array: require('./array'), | ||
arr: require('./array') | ||
isImmutableCollection: require('./predicate') | ||
} |
'use strict'; | ||
var isImmutableCollection = require('./predicate') | ||
// Internal | ||
@@ -27,3 +29,3 @@ var extend = function(t, f) { for ( var p in f ) t[p] = f[p]; return t } | ||
var areEqual = function(v1, v2){ | ||
if ( v1 && typeof v1.equal == 'function' && v1.immutable ) | ||
if ( v1 && typeof v1.equal == 'function' && isImmutableCollection(v1) ) | ||
return v1.equal(v2) | ||
@@ -30,0 +32,0 @@ else return v1 === v2 |
@@ -51,3 +51,3 @@ var a = require('assert') | ||
describe('length', function(){ | ||
describe('.length', function(){ | ||
it('should get updated to be the largest int + 1', function(){ | ||
@@ -116,3 +116,3 @@ var arr1 = im.array([1, 2, 3]) | ||
describe('forEach', function(){ | ||
describe('.forEach', function(){ | ||
it('should pass val, key, array, but return nothing', function(){ | ||
@@ -137,3 +137,3 @@ var results = [] | ||
describe('every', function(){ | ||
describe('.every', function(){ | ||
var isOdd = function(n){ return n % 2 !== 0 } | ||
@@ -169,3 +169,3 @@ | ||
describe('some', function(){ | ||
describe('.some', function(){ | ||
var isOdd = function(n){ return n % 2 !== 0 } | ||
@@ -202,3 +202,3 @@ | ||
describe('filter', function(){ | ||
describe('.filter', function(){ | ||
var isOdd = function(n){ return n % 2 !== 0 } | ||
@@ -228,3 +228,3 @@ | ||
describe('reduce', function(){ | ||
describe('.reduce', function(){ | ||
@@ -255,3 +255,3 @@ it('should reduce over collection in left to right order', function(){ | ||
describe('reduceRight', function(){ | ||
describe('.reduceRight', function(){ | ||
@@ -282,3 +282,3 @@ it('should reduce over collection in right to left order', function(){ | ||
describe('equal', function(){ | ||
describe('.equal', function(){ | ||
@@ -339,3 +339,3 @@ it('should return false if the value is not an immutable object', function(){ | ||
describe('push', function(){ | ||
describe('.push', function(){ | ||
it('should add on a new array member at the end', function(){ | ||
@@ -349,3 +349,3 @@ var arr1 = im.array([1, 2, 3]) | ||
describe('indexOf', function(){ | ||
describe('.indexOf', function(){ | ||
it('should return the indexOf an element found with .equal', function(){ | ||
@@ -352,0 +352,0 @@ var arr1 = im.array([1, 2, 3, im.object({ x: 3 })]) |
@@ -8,3 +8,4 @@ var a = require('assert') | ||
a.equal(im.array, require('../src/array')) | ||
a.equal(im.isImmutableCollection, require('../src/predicate')) | ||
}) | ||
}) |
@@ -129,3 +129,3 @@ var a = require('assert') | ||
describe('forEach', function(){ | ||
describe('.forEach', function(){ | ||
it('should pass val, key, object, but return nothing', function(){ | ||
@@ -149,3 +149,3 @@ var results = {} | ||
describe('every', function(){ | ||
describe('.every', function(){ | ||
var isOdd = function(n){ return n % 2 !== 0 } | ||
@@ -181,3 +181,3 @@ | ||
describe('some', function(){ | ||
describe('.some', function(){ | ||
var isOdd = function(n){ return n % 2 !== 0 } | ||
@@ -213,3 +213,3 @@ | ||
describe('filter', function(){ | ||
describe('.filter', function(){ | ||
var isOdd = function(n){ return n % 2 !== 0 } | ||
@@ -239,3 +239,3 @@ | ||
describe('reduce', function(){ | ||
describe('.reduce', function(){ | ||
@@ -267,3 +267,3 @@ it('should reduce over collection in any order', function(){ | ||
describe('equal', function(){ | ||
describe('.equal', function(){ | ||
@@ -270,0 +270,0 @@ it('should return false if the value is not an immutable object', function(){ |
Sorry, the diff of this file is not supported yet
53819
12
869
266