Skip to content

Commit

Permalink
Reemplazo Object.assign() por bestGlobals.changing()
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Nov 7, 2016
1 parent 4e5107d commit dabf4c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 56 deletions.
30 changes: 2 additions & 28 deletions lib/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,6 @@ var margin = ' ';
var separators=';,\t|';
var delimiters='\'"';

/* istanbul ignore if */
if (typeof Object.assign != 'function') {
(function () {
Object.assign = function (target) {
//'use strict';
// We must check against these specific cases.
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
};
})();
}


function adaptPlain(x){
if(x===''){ return 'null'; }
return x;
Expand All @@ -59,7 +33,7 @@ var types = [
];

function mapTypes(typeNames) {
return typeNames.map(function(type, index) { return Object.assign({typeName:type}, types[index]); });
return typeNames.map(function(type, index) { return changing({typeName:type}, types[index]); });
}

function quoteBackTick(objectName) { return '`'+objectName.replace(/`/g,'``')+'`'; }
Expand Down Expand Up @@ -637,7 +611,7 @@ function catchErrors(info, err) {

function generatePrepareResult(info) {
var columns = info.columnsInfo.map(function(columnInfo) {
var col = Object.assign({type:columnInfo.typeInfo.typeName}, columnInfo);
var col = changing({type:columnInfo.typeInfo.typeName}, columnInfo);
delete col.typeInfo;
delete col.columnLength;
return col;
Expand Down
30 changes: 2 additions & 28 deletions web/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,6 @@ var margin = ' ';
var separators=';,\t|';
var delimiters='\'"';

/* istanbul ignore if */
if (typeof Object.assign != 'function') {
(function () {
Object.assign = function (target) {
//'use strict';
// We must check against these specific cases.
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
};
})();
}


function adaptPlain(x){
if(x===''){ return 'null'; }
return x;
Expand All @@ -59,7 +33,7 @@ var types = [
];

function mapTypes(typeNames) {
return typeNames.map(function(type, index) { return Object.assign({typeName:type}, types[index]); });
return typeNames.map(function(type, index) { return changing({typeName:type}, types[index]); });
}

function quoteBackTick(objectName) { return '`'+objectName.replace(/`/g,'``')+'`'; }
Expand Down Expand Up @@ -637,7 +611,7 @@ function catchErrors(info, err) {

function generatePrepareResult(info) {
var columns = info.columnsInfo.map(function(columnInfo) {
var col = Object.assign({type:columnInfo.typeInfo.typeName}, columnInfo);
var col = changing({type:columnInfo.typeInfo.typeName}, columnInfo);
delete col.typeInfo;
delete col.columnLength;
return col;
Expand Down

0 comments on commit dabf4c6

Please sign in to comment.