Skip to content

Commit

Permalink
Fix generator functions in newer v8 / io.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 20, 2015
1 parent b1828a6 commit 9e907dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ var dateType = '[object Date]';
var regexType = '[object RegExp]';
var arrayType = '[object Array]';
var funcType = '[object Function]';
var v8GeneratorFuncType = '[object GeneratorFunction]';
var objType = '[object Object]';

var isFunction = function (type) {
return type === funcType || type === v8GeneratorFuncType;
};

module.exports = function isEqual(value, other) {
if (value === other) { return true; }

Expand Down Expand Up @@ -67,7 +72,7 @@ module.exports = function isEqual(value, other) {
return index <= 0;
}

if (type === funcType) {
if (isFunction(type)) {
if (!isEqual(value.name, other.name)) { return false; }
if (!isEqual(value.length, other.length)) { return false; }

Expand Down

0 comments on commit 9e907dd

Please sign in to comment.