Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert tab to space #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
102 changes: 51 additions & 51 deletions mixin.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
(function(define, global) { 'use strict';
define(function () {
return function(des, src, map){
if(typeof des !== 'object'
&& typeof des !== 'function'){
throw new TypeError('Unable to enumerate properties of '+ des);
}
if(typeof src !== 'object'
&& typeof src !== 'function'){
throw new TypeError('Unable to enumerate properties of '+ src);
}
define(function () {
return function(des, src, map){
if(typeof des !== 'object'
&& typeof des !== 'function'){
throw new TypeError('Unable to enumerate properties of '+ des);
}
if(typeof src !== 'object'
&& typeof src !== 'function'){
throw new TypeError('Unable to enumerate properties of '+ src);
}

map = map || function(d, s, i, des, src){
//这里要加一个des[i],是因为要照顾一些不可枚举的属性
if(!(des[i] || (i in des))){
return s;
}
return d;
}
map = map || function(d, s, i, des, src){
//这里要加一个des[i],是因为要照顾一些不可枚举的属性
if(!(des[i] || (i in des))){
return s;
}
return d;
}

if(map === true){ //override
map = function(d,s){
return s;
}
}
if(map === true){ //override
map = function(d,s){
return s;
}
}

for (var i in src) {
des[i] = map(des[i], src[i], i, des, src);
//如果返回undefined,尝试删掉这个属性
if(des[i] === undefined) delete des[i];
}
return des;
}
});
for (var i in src) {
des[i] = map(des[i], src[i], i, des, src);
//如果返回undefined,尝试删掉这个属性
if(des[i] === undefined) delete des[i];
}
return des;
}
});
}) (
typeof define === 'function' && define.amd ? define : function (name, requires, factory) {
if(typeof name === 'function') {
factory = name, name = undefined, requires = [];
} else if(typeof requires === 'function') {
factory = requires, requires = [];
}
typeof define === 'function' && define.amd ? define : function (name, requires, factory) {
if(typeof name === 'function') {
factory = name, name = undefined, requires = [];
} else if(typeof requires === 'function') {
factory = requires, requires = [];
}

if(typeof module != 'undefined' && module.exports){
var _requires = [];
for(var i = 0; i < requires.length; i++){
_requires.push(require(requires[i]));
}
module.exports = factory.apply(this, _requires);
}else if(typeof window != 'undefined'){
var _requires = [];
for(var i = 0; i < requires.length; i++){
_requires.push(window[requires[i]]);
}
window[name || 'mixin'] = factory.apply(this, _requires);
}
},
this
if(typeof module != 'undefined' && module.exports){
var _requires = [];
for(var i = 0; i < requires.length; i++){
_requires.push(require(requires[i]));
}
module.exports = factory.apply(this, _requires);
}else if(typeof window != 'undefined'){
var _requires = [];
for(var i = 0; i < requires.length; i++){
_requires.push(window[requires[i]]);
}
window[name || 'mixin'] = factory.apply(this, _requires);
}
},
this
);