Skip to content

Commit

Permalink
Merge branch 'release/0.4.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Sep 4, 2018
2 parents dc00c4d + b9bc662 commit 2225381
Show file tree
Hide file tree
Showing 23 changed files with 14,214 additions and 13,949 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Changelog

> 0.4.11 "Lawdar" (xx.10.2018)
> 0.4.10 "Maoshk" (xx.9.2018)
> 0.4.11 "Lawdar" (xx.10.2018)


## 0.4.10 "Maoshk" (04.10.2018)


Add: xlsxml files with multiple sheets


## 0.4.9 "Alsalfiah" (05.08.2018)
Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# How to Contribute to the AlaSQL project

Thank you very much or the your intentions! AlaSQL project still has a lot of thing to be improved, and your help is very appreciated!
Thank you very much for your interest! AlaSQL project still has a lot of thing to be improved, and your help is very appreciated!

For you to edit the source please do the following:

Expand All @@ -15,11 +15,10 @@ For you to edit the source please do the following:
- Run `npm test` to verify only the new test fails
- Implement your contributions in `src/`
- Run `npm test` and verify all tests are OK
- Commit changes to git and push to your forked repo
- Commit changes to git and push to your forked repo (including the `dist/` folder)
- Click "Create Pull-request" when looking at your forked repo on Github

_Please note that `npm test` will compile from `src/` and overwrite `dist/` before running all tests_


If you would would like to change the alasql.org website please make a PR to https://github.com/agershun/alasql-org
If you would like to change the alasql.org website please make a PR to https://github.com/agershun/alasql-org

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ _Got a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/328/badge)](https://bestpractices.coreinfrastructure.org/projects/328)
[![](https://data.jsdelivr.com/v1/package/npm/alasql/badge?style=rounded)](https://www.jsdelivr.com/package/npm/alasql)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fagershun%2Falasql.svg?type=small)](https://app.fossa.io/projects/git%2Bgithub.com%2Fagershun%2Falasql?ref=badge_small)




Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@
"bin",
"lib"
],
"version": "0.4.9"
"version": "0.4.10"
}
4 changes: 2 additions & 2 deletions dist/alasql-worker.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! AlaSQL v0.4.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL v0.4.10 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.9
@version 0.4.10
AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
Expand Down
2 changes: 1 addition & 1 deletion dist/alasql-worker.min.js
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 43 additions & 8 deletions dist/alasql.fs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! AlaSQL v0.4.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL v0.4.10 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.9
@version 0.4.10

AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
Expand Down Expand Up @@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
Current version of alasql
@constant {string}
*/
alasql.version = '0.4.9';
alasql.version = '0.4.10';

/**
Debug flag
Expand Down Expand Up @@ -4288,8 +4288,12 @@ utils.findAlaSQLPath = function() {
};

var getXLSX = function() {
var XLSX = null;
/* If require() shuold be supported else take from global scope */
var XLSX = alasql.private.externalXlsxLib;

if (XLSX) {
return XLSX;
}

if (utils.isNode || utils.isBrowserify || utils.isMeteorServer) {
//*not-for-browser/*
XLSX = require('xlsx') || null;
Expand Down Expand Up @@ -4527,6 +4531,14 @@ alasql.lastid = 0;

alasql.buffer = {};

alasql.private = {
externalXlsxLib: null,
};

alasql.setXLSX = function(XLSX) {
alasql.private.externalXlsxLib = XLSX;
};

/**
Select current database
@param {string} databaseid Selected database identificator
Expand Down Expand Up @@ -16720,10 +16732,18 @@ alasql.into.XLSXML = function(filename, opts, data, columns, cb) {

// Set sheets
var sheets = {};
var sheetsdata;
var sheetscolumns;
if (opts && opts.sheets) {
sheets = opts.sheets;
// data and columns are already an array for the sheets
sheetsdata = data;
sheetscolumns = columns;
} else {
sheets.Sheet1 = opts;
// wrapd ata and columns array for single sheet
sheetsdata = [data];
sheetscolumns = [columns];
}

// File is ready to save
Expand Down Expand Up @@ -16796,15 +16816,30 @@ alasql.into.XLSXML = function(filename, opts, data, columns, cb) {
return 's' + styles[hh].styleid;
}

function values(obj) {
try {
return Object.values(obj);
} catch (e) {
// support for older runtimes
return Object.keys(obj).map(function(e) {
return obj[e];
});
}
}

var sheetidx = 0;
for (var sheetid in sheets) {
var sheet = sheets[sheetid];

var idx = typeof sheet.dataidx != 'undefined' ? sheet.dataidx : sheetidx++;
var data = values(sheetsdata[idx]);
// If columns defined in sheet, then take them
var columns = undefined;
if (typeof sheet.columns != 'undefined') {
columns = sheet.columns;
} else {
// Autogenerate columns if they are passed as parameters
if (columns.length == 0 && data.length > 0) {
columns = sheetscolumns[idx];
if (columns === undefined || (columns.length == 0 && data.length > 0)) {
if (typeof data[0] == 'object') {
if (Array.isArray(data[0])) {
columns = data[0].map(function(d, columnidx) {
Expand Down Expand Up @@ -16836,7 +16871,7 @@ alasql.into.XLSXML = function(filename, opts, data, columns, cb) {
if (typeof column.columnid == 'undefined') column.columnid = columnidx;
if (typeof column.title == 'undefined') column.title = '' + column.columnid.trim();
if (sheet.headers && Array.isArray(sheet.headers))
column.title = sheet.headers[idx];
column.title = sheet.headers[columnidx];
});

// Header
Expand Down
51 changes: 43 additions & 8 deletions dist/alasql.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! AlaSQL v0.4.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL v0.4.10 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.9
@version 0.4.10

AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
Expand Down Expand Up @@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
Current version of alasql
@constant {string}
*/
alasql.version = '0.4.9';
alasql.version = '0.4.10';

/**
Debug flag
Expand Down Expand Up @@ -4283,8 +4283,12 @@ utils.findAlaSQLPath = function() {
};

var getXLSX = function() {
var XLSX = null;
/* If require() shuold be supported else take from global scope */
var XLSX = alasql["private"].externalXlsxLib;

if (XLSX) {
return XLSX;
}

if (utils.isNode || utils.isBrowserify || utils.isMeteorServer) {
/*not-for-browser/*
XLSX = require('xlsx') || null;
Expand Down Expand Up @@ -4522,6 +4526,14 @@ alasql.lastid = 0;

alasql.buffer = {};

alasql["private"] = {
externalXlsxLib: null,
};

alasql.setXLSX = function(XLSX) {
alasql["private"].externalXlsxLib = XLSX;
};

/**
Select current database
@param {string} databaseid Selected database identificator
Expand Down Expand Up @@ -16715,10 +16727,18 @@ alasql.into.XLSXML = function(filename, opts, data, columns, cb) {

// Set sheets
var sheets = {};
var sheetsdata;
var sheetscolumns;
if (opts && opts.sheets) {
sheets = opts.sheets;
// data and columns are already an array for the sheets
sheetsdata = data;
sheetscolumns = columns;
} else {
sheets.Sheet1 = opts;
// wrapd ata and columns array for single sheet
sheetsdata = [data];
sheetscolumns = [columns];
}

// File is ready to save
Expand Down Expand Up @@ -16791,15 +16811,30 @@ alasql.into.XLSXML = function(filename, opts, data, columns, cb) {
return 's' + styles[hh].styleid;
}

function values(obj) {
try {
return Object.values(obj);
} catch (e) {
// support for older runtimes
return Object.keys(obj).map(function(e) {
return obj[e];
});
}
}

var sheetidx = 0;
for (var sheetid in sheets) {
var sheet = sheets[sheetid];

var idx = typeof sheet.dataidx != 'undefined' ? sheet.dataidx : sheetidx++;
var data = values(sheetsdata[idx]);
// If columns defined in sheet, then take them
var columns = undefined;
if (typeof sheet.columns != 'undefined') {
columns = sheet.columns;
} else {
// Autogenerate columns if they are passed as parameters
if (columns.length == 0 && data.length > 0) {
columns = sheetscolumns[idx];
if (columns === undefined || (columns.length == 0 && data.length > 0)) {
if (typeof data[0] == 'object') {
if (Array.isArray(data[0])) {
columns = data[0].map(function(d, columnidx) {
Expand Down Expand Up @@ -16831,7 +16866,7 @@ alasql.into.XLSXML = function(filename, opts, data, columns, cb) {
if (typeof column.columnid == 'undefined') column.columnid = columnidx;
if (typeof column.title == 'undefined') column.title = '' + column.columnid.trim();
if (sheet.headers && Array.isArray(sheet.headers))
column.title = sheet.headers[idx];
column.title = sheet.headers[columnidx];
});

// Header
Expand Down
16 changes: 8 additions & 8 deletions dist/alasql.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alasql",
"description": "Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV",
"version": "0.4.9",
"version": "0.4.10",
"author": "Andrey Gershun <[email protected]>",
"contributors": [
"Mathias Rangel Wulff <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion src/05copyright.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! AlaSQL vPACKAGE_VERSION_NUMBER | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL vPACKAGE_VERSION_NUMBER | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version PACKAGE_VERSION_NUMBER
Expand Down
8 changes: 6 additions & 2 deletions src/15utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,12 @@ utils.findAlaSQLPath = function() {
};

var getXLSX = function() {
var XLSX = null;
/* If require() shuold be supported else take from global scope */
var XLSX = alasql.private.externalXlsxLib;

if (XLSX) {
return XLSX;
}

if (utils.isNode || utils.isBrowserify || utils.isMeteorServer) {
//*not-for-browser/*
XLSX = require('xlsx') || null;
Expand Down
8 changes: 8 additions & 0 deletions src/17alasql.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ alasql.lastid = 0;

alasql.buffer = {};

alasql.private = {
externalXlsxLib: null,
};

alasql.setXLSX = function(XLSX) {
alasql.private.externalXlsxLib = XLSX;
};

/**
Select current database
@param {string} databaseid Selected database identificator
Expand Down
Loading

0 comments on commit 2225381

Please sign in to comment.