Skip to content

Instantly share code, notes, and snippets.

View xwartz's full-sized avatar
🎯
Focusing

xwartz xwartz

🎯
Focusing
View GitHub Profile
@xwartz
xwartz / nomatch.RegExp
Last active September 5, 2015 07:42
不匹配任何字符串的正则
var noMatch = /\w\b\w/;
var noMatch = /(.)^/;
@xwartz
xwartz / _.cloneDeep.js
Last active November 16, 2015 16:05
underscorejs 深拷贝实现
// 普通字面量对象的深拷贝
_.cloneDeep = function (obj) {
if (typeof(obj) != 'object' || obj == null) return obj;
if(obj instanceof Date) {
return new Date(obj.getTime());
}
var newObj = {};
// 数组
if(Object.prototype.toString.call(obj) === '[object Array]') {