From 1a5fc011111b264c657a9721dbd0bdfccd1c3ee3 Mon Sep 17 00:00:00 2001 From: zhengqizhang <770166635@qq.com> Date: Sun, 8 Apr 2018 14:41:53 +0800 Subject: [PATCH] Add two isType methods, for Promise and Generator --- underscore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/underscore.js b/underscore.js index 10f5795dc..4fc4837f7 100644 --- a/underscore.js +++ b/underscore.js @@ -1317,8 +1317,8 @@ return type === 'function' || type === 'object' && !!obj; }; - // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError, isMap, isWeakMap, isSet, isWeakSet. - _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', 'WeakMap', 'Set', 'WeakSet'], function(name) { + // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError, isMap, isWeakMap, isSet, isWeakSet, isPromise, isGenerator. + _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', 'WeakMap', 'Set', 'WeakSet', 'Promise' ,'Generator'], function(name) { _['is' + name] = function(obj) { return toString.call(obj) === '[object ' + name + ']'; };