Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@ sudo: false
language: node_js

node_js:
- '5.0'
- '8.11.1'

before_script:
- npm install
- npm install -g grunt-cli jshint

script: npm run travis-test

env:
- SAUCE_USERNAME=seamless-immutable

addons:
sauce_connect: true
jwt:
secure: Ie6IHRQ1KPcnlhEKPR99NhVnMArpuSeMphc9Lr/513FpNSg8rVfWlLqYBVrjP5E1pliXMu47ojT1el4BvFdOYFiwKwYAZq8RnFoSAwV0z65F/BbsqVFhCP8DLOMB6Oy/I4Mu2IMf1uC1Q2FyPygSPI90mQ2jcAZkYuE7e4yYsDU=
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ This level of backwards compatibility requires [ECMAScript 5](http://kangax.gith

[![build status][1]][2] [![NPM version][3]][4] [![coverage status][5]][6]

[![Sauce Test Status](https://saucelabs.com/browser-matrix/seamless-immutable.svg)](https://saucelabs.com/u/seamless-immutable)

## Performance

Whenever you deeply clone large nested objects, it should typically go much faster with `Immutable` data structures. This is because the library reuses the existing nested objects rather than instantiating new ones.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"coveralls": "2.11.8",
"deep-equal": "1.0.1",
"envify": "3.4.0",
"grunt": "0.4.5",
"grunt": "^1.0.2",
"grunt-contrib-uglify": "0.11.1",
"grunt-mocha-test": "0.12.7",
"istanbul": "0.4.2",
"jscheck": "0.2.0",
"jshint": "^2.9.5",
"lodash": "3.10.1",
"mocha": "2.4.5",
"mocha-istanbul": "0.2.0",
Expand All @@ -27,9 +28,8 @@
"test-watch": "mocha --watch test/*.spec.js",
"jshint": "jshint seamless-immutable.development.js",
"coverage": "export ISTANBUL_REPORTERS=text-summary,html,lcov && rm -rf tmp/ && rm -rf html-report/ && istanbul instrument test/ -o tmp/ && mocha --reporter mocha-istanbul tmp/*.spec.js && echo Open html-report/index.html to view results as HTML.",
"zuul": "zuul -- test/*.spec.js",
"zuul-local": "zuul --local -- test/*.spec.js",
"travis-test": "npm run jshint && npm test && npm run zuul && npm run coveralls",
"travis-test": "npm run jshint && npm test && npm run coveralls",
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"repository": {
Expand Down
11 changes: 5 additions & 6 deletions seamless-immutable.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,19 +739,18 @@ function immutableInit(config) {
return Immutable;
}

var Immutable = immutableInit();
/* istanbul ignore if */
if (typeof define === 'function' && define.amd) {
define(function() {
return Immutable;
return immutableInit();
});
} else if (typeof module === "object") {
module.exports = Immutable;
module.exports = immutableInit();
} else if (typeof exports === "object") {
exports.Immutable = Immutable;
exports.Immutable = immutableInit();
} else if (typeof window === "object") {
window.Immutable = Immutable;
window.Immutable = immutableInit();
} else if (typeof global === "object") {
global.Immutable = Immutable;
global.Immutable = immutableInit();
}
})();
2 changes: 1 addition & 1 deletion seamless-immutable.development.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion seamless-immutable.production.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions src/seamless-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,19 +739,18 @@ function immutableInit(config) {
return Immutable;
}

var Immutable = immutableInit();
/* istanbul ignore if */
if (typeof define === 'function' && define.amd) {
define(function() {
return Immutable;
return immutableInit();
});
} else if (typeof module === "object") {
module.exports = Immutable;
module.exports = immutableInit();
} else if (typeof exports === "object") {
exports.Immutable = Immutable;
exports.Immutable = immutableInit();
} else if (typeof window === "object") {
window.Immutable = Immutable;
window.Immutable = immutableInit();
} else if (typeof global === "object") {
global.Immutable = Immutable;
global.Immutable = immutableInit();
}
})();
6 changes: 6 additions & 0 deletions test/Immutable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,27 @@ var getTestUtils = require("./TestUtils.js");
});

it("doesn't modify File objects", function() {
global.File = TestUtils.FileMock;
var file = new File(['part'], 'filename.jpg');
var immutableFile = Immutable(file);

assert.isTrue(file instanceof File, "file instanceof File");
assert.isTrue(immutableFile instanceof File, "immutableFile instanceof File");
assert.equal(immutableFile, file);

delete global.File;
});

it("doesnt modify Blob objects", function() {
global.Blob = TestUtils.BlobMock;
var blob = new Blob();
var immutableBlob = Immutable(blob);

assert.isTrue(blob instanceof Blob, "blob instanceof Blob");
assert.isTrue(immutableBlob instanceof Blob, "immutableBlob instanceof Blob");
assert.equal(immutableBlob, blob);

delete global.Blob;
});

it("doesn't modify Error objects", function () {
Expand Down
14 changes: 14 additions & 0 deletions test/TestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@ function isDeepEqual(a, b) {
return (deepEqual(a, b) || (a !== a && b !== b));
}

// window.File mock
function File(parts, filename) {
this.name = 'ok';
this.size = 4;
this.lastModifiedDate = new Date();
this.lastModified = this.lastModifiedDate.getTime();
}

// window.Blob mock
function Blob() {
this.size = 0;
this.type = '';
}

module.exports = function(Immutable) {
return {
assertJsonEqual: assertJsonEqual,
Expand Down