alasql 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/alasql-cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  //
3
3
  // Command line interface for Alasql
4
- // Version: 0.2.2
4
+ // Version: 0.2.8
5
5
  // Date: 28.07.2015
6
6
  // (c) 2014-2015, Andrey Gershun & M. Rangel Wulff
7
7
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.2.7 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.2.8 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.2.7
4
+ @version 0.2.8
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v0.2.7 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.2.8 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  !function(e,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?module.exports=r():e.alasql=r()}(this,function(){function e(r,t,s){var a=e.lastid++;e.buffer[a]=s,e.webworker.postMessage({id:a,sql:r,params:t})}return"undefined"==typeof location||!location.reload||"undefined"!=typeof process&&process.browser||"function"==typeof require&&"function"==typeof require.specified||(e.worker=function(r,t,s){if(r===!0&&(r=void 0),"undefined"==typeof r)for(var a=document.getElementsByTagName("script"),o=0;o<a.length;o++){if("alasql-worker.js"===a[o].src.substr(-16).toLowerCase()){r=a[o].src.substr(0,a[o].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===a[o].src.substr(-20).toLowerCase()){r=a[o].src.substr(0,a[o].src.length-20)+"alasql.min.js";break}if("alasql.js"===a[o].src.substr(-9).toLowerCase()){r=a[o].src;break}if("alasql.min.js"===a[o].src.substr(-13).toLowerCase()){r=a[o].src.substr(0,a[o].src.length-13)+"alasql.min.js";break}}if("undefined"==typeof r)throw new Error("Path to alasql.js is not specified");if(r!==!1){var n="importScripts('";n+=r,n+="');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}";var i=new Blob([n],{type:"text/plain"});if(e.webworker=new Worker(URL.createObjectURL(i)),e.webworker.onmessage=function(r){var t=r.data.id;e.buffer[t](r.data.data),delete e.buffer[t]},e.webworker.onerror=function(e){throw e},arguments.length>1){var f="REQUIRE "+t.map(function(e){return'"'+e+'"'}).join(",");e(f,[],s)}}else if(r===!1)return void delete e.webworker}),e.lastid=0,e.buffer={},e.worker(),e});
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.2.7 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.2.8 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.2.7
4
+ @version 0.2.8
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -140,7 +140,7 @@ var alasql = function(sql, params, cb, scope) {
140
140
  Current version of alasql
141
141
  @constant {string}
142
142
  */
143
- alasql.version = '0.2.7';
143
+ alasql.version = '0.2.8';
144
144
 
145
145
  /**
146
146
  Debug flag
@@ -3725,11 +3725,11 @@ var cloneDeep = utils.cloneDeep = function cloneDeep(obj) {
3725
3725
  return new Date(obj);
3726
3726
  }
3727
3727
 
3728
- var temp = obj.constructor(); // changed
3728
+ var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
3729
3729
 
3730
3730
  for(var key in obj) {
3731
3731
  if(obj.hasOwnProperty(key)) {
3732
- temp[key] = cloneDeep(obj[key]);
3732
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
3733
3733
  }
3734
3734
  }
3735
3735
  return temp;
@@ -3800,7 +3800,7 @@ var extend = utils.extend = function extend (a,b){
3800
3800
  a = a || {};
3801
3801
  for(var key in b) {
3802
3802
  if(b.hasOwnProperty(key)) {
3803
- a[key] = b[key];
3803
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
3804
3804
  }
3805
3805
  }
3806
3806
  return a;
@@ -8027,7 +8027,7 @@ yy.Select.prototype.compileGroup = function(query) {
8027
8027
  var aft = '', aft2='';
8028
8028
 
8029
8029
  if(typeof query.groupStar !== 'undefined') {
8030
- aft2 += 'for(var f in p[\''+query.groupStar+'\']) {g[f]=p[\''+query.groupStar+'\'][f];};';
8030
+ aft2 += 'for(var f in p[\''+query.groupStar+'\']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p[\''+query.groupStar+'\'][f];};';
8031
8031
  };
8032
8032
 
8033
8033
  /*
@@ -8240,7 +8240,7 @@ function compileSelectStar (query, alias, joinstar) {
8240
8240
  } else {
8241
8241
 
8242
8242
  // if column not exists, then copy all
8243
- sp += 'var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';
8243
+ sp += 'var w=p["'+alias+'"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
8244
8244
 
8245
8245
  query.dirtyColumns = true;
8246
8246
  }
@@ -8485,7 +8485,7 @@ yy.Select.prototype.compileSelectGroup1 = function(query) {
8485
8485
 
8486
8486
  if(col instanceof yy.Column && col.columnid === '*') {
8487
8487
 
8488
- s += 'for(var k in g) {r[k]=g[k]};';
8488
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
8489
8489
  return '';
8490
8490
 
8491
8491
  } else {
@@ -11172,7 +11172,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
11172
11172
  // Do UPDATE!!!
11173
11173
 
11174
11174
  table.update(function(t){
11175
- for(var f in r) t[f] = r[f];
11175
+ for(var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
11176
11176
  },table.data.indexOf(toreplace),params);
11177
11177
  } else {
11178
11178
  table.data.push(r);