Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
Merged
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"mocha": "2.4.5",
"mocha-istanbul": "0.2.0",
"mocha-lcov-reporter": "1.2.0",
"react": "^15.0.1",
"zuul": "3.9.0"
},
"scripts": {
Expand Down
14 changes: 13 additions & 1 deletion seamless-immutable.development.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
(function() {
"use strict";

// https://github.com/facebook/react/blob/v15.0.1/src/isomorphic/classic/element/ReactElement.js#L21
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element');
var REACT_ELEMENT_TYPE_FALLBACK = 0xeac7;

function addPropertyTo(target, methodName, value) {
Object.defineProperty(target, methodName, {
enumerable: false,
Expand Down Expand Up @@ -497,8 +501,16 @@
return makeImmutable(obj, mutatingObjectMethods);
}

// Returns true if object is a valid react element
// https://github.com/facebook/react/blob/v15.0.1/src/isomorphic/classic/element/ReactElement.js#L326
function isReactElement(obj) {
return typeof obj === 'object' &&
obj !== null &&
(obj.$$typeof === REACT_ELEMENT_TYPE_FALLBACK || obj.$$typeof === REACT_ELEMENT_TYPE);
}

function Immutable(obj, options, stackRemaining) {
if (isImmutable(obj)) {
if (isImmutable(obj) || isReactElement(obj)) {
return obj;
} else if (obj instanceof Array) {
return makeImmutableArray(obj.slice());
Expand Down
2 changes: 1 addition & 1 deletion seamless-immutable.development.min.js

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

Loading