alasql 2.1.6 → 2.1.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/.editorconfig +11 -0
- package/.eslintignore +2 -0
- package/README.md +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +1 -1
- package/dist/alasql.fs.js +227 -632
- package/dist/alasql.js +225 -632
- package/dist/alasql.min.js +3 -3
- package/package.json +5 -4
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v2.1.
|
|
1
|
+
//! AlaSQL v2.1.7-develop-295886e2 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 2.1.
|
|
4
|
+
@version 2.1.7-develop-295886e2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '2.1.
|
|
145
|
+
alasql.version = '2.1.7-develop-295886e2';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -3178,64 +3178,64 @@ alasql.pretty = function (sql, flag) {
|
|
|
3178
3178
|
var utils = (alasql.utils = {});
|
|
3179
3179
|
|
|
3180
3180
|
/**
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3181
|
+
Convert NaN to undefined
|
|
3182
|
+
@function
|
|
3183
|
+
@param {string} s JavaScript string to be modified
|
|
3184
|
+
@return {string} Covered expression
|
|
3185
3185
|
|
|
3186
|
-
|
|
3186
|
+
@example
|
|
3187
3187
|
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3188
|
+
123 => 123
|
|
3189
|
+
undefined => undefined
|
|
3190
|
+
NaN => undefined
|
|
3191
3191
|
|
|
3192
|
-
|
|
3192
|
+
*/
|
|
3193
3193
|
function n2u(s) {
|
|
3194
3194
|
return '(y=' + s + ',y===y?y:undefined)';
|
|
3195
3195
|
}
|
|
3196
3196
|
|
|
3197
3197
|
/**
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3198
|
+
Return undefined if s undefined
|
|
3199
|
+
@param {string} s JavaScript string to be modified
|
|
3200
|
+
@return {string} Covered expression
|
|
3201
3201
|
|
|
3202
|
-
|
|
3202
|
+
@example
|
|
3203
3203
|
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3204
|
+
123,a => a
|
|
3205
|
+
undefined,a => undefined
|
|
3206
|
+
NaN,a => undefined
|
|
3207
3207
|
|
|
3208
|
-
|
|
3208
|
+
*/
|
|
3209
3209
|
function und(s, r) {
|
|
3210
3210
|
return '(y=' + s + ',typeof y=="undefined"?undefined:' + r + ')';
|
|
3211
3211
|
}
|
|
3212
3212
|
|
|
3213
3213
|
/**
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3214
|
+
Return always true. Stub for non-ecisting WHERE clause, because is faster then if(whenrfn) whenfn()
|
|
3215
|
+
@function
|
|
3216
|
+
@return {boolean} Always true
|
|
3217
|
+
*/
|
|
3218
3218
|
function returnTrue() {
|
|
3219
3219
|
return true;
|
|
3220
3220
|
}
|
|
3221
3221
|
|
|
3222
3222
|
/**
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3223
|
+
Return undefined. Stub for non-ecisting WHERE clause, because is faster then if(whenrfn) whenfn()
|
|
3224
|
+
@function
|
|
3225
|
+
@return {undefined} Always undefined
|
|
3226
|
+
*/
|
|
3227
3227
|
function returnUndefined() {}
|
|
3228
3228
|
|
|
3229
3229
|
/**
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3230
|
+
Escape string
|
|
3231
|
+
@function
|
|
3232
|
+
@param {string} s Source string
|
|
3233
|
+
@return {string} Escaped string
|
|
3234
|
+
@example
|
|
3235
3235
|
|
|
3236
|
-
|
|
3236
|
+
Pit\er's => Pit\\er\'s
|
|
3237
3237
|
|
|
3238
|
-
|
|
3238
|
+
*/
|
|
3239
3239
|
// based on joliss/js-string-escape
|
|
3240
3240
|
var escapeq = (utils.escapeq = function (s) {
|
|
3241
3241
|
|
|
@@ -3262,49 +3262,49 @@ var escapeq = (utils.escapeq = function (s) {
|
|
|
3262
3262
|
});
|
|
3263
3263
|
|
|
3264
3264
|
/**
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3265
|
+
Double quotes for SQL statements
|
|
3266
|
+
@param {string} s Source string
|
|
3267
|
+
@return {string} Escaped string
|
|
3268
3268
|
|
|
3269
|
-
|
|
3269
|
+
@example
|
|
3270
3270
|
|
|
3271
|
-
|
|
3271
|
+
Piter's => Piter''s
|
|
3272
3272
|
|
|
3273
|
-
|
|
3273
|
+
*/
|
|
3274
3274
|
var escapeqq = (utils.undoubleq = function (s) {
|
|
3275
3275
|
return s.replace(/(\')/g, "''");
|
|
3276
3276
|
});
|
|
3277
3277
|
|
|
3278
3278
|
/**
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3279
|
+
Replace double quotes with single quote
|
|
3280
|
+
@param {string} s Source string
|
|
3281
|
+
@return {string} Replaced string
|
|
3282
|
+
@example
|
|
3283
3283
|
|
|
3284
|
-
|
|
3284
|
+
Piter''s => Piter's
|
|
3285
3285
|
|
|
3286
|
-
|
|
3286
|
+
*/
|
|
3287
3287
|
var doubleq = (utils.doubleq = function (s) {
|
|
3288
3288
|
return s.replace(/(\'\')/g, "\\'");
|
|
3289
3289
|
});
|
|
3290
3290
|
|
|
3291
3291
|
/**
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3292
|
+
Replace sigle quote to escaped single quote
|
|
3293
|
+
@param {string} s Source string
|
|
3294
|
+
@return {string} Replaced string
|
|
3295
3295
|
|
|
3296
|
-
|
|
3296
|
+
@todo Chack this functions
|
|
3297
3297
|
|
|
3298
|
-
|
|
3298
|
+
*/
|
|
3299
3299
|
var doubleqq = (utils.doubleqq = function (s) {
|
|
3300
3300
|
return s.replace(/\'/g, "'");
|
|
3301
3301
|
});
|
|
3302
3302
|
|
|
3303
3303
|
/**
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3304
|
+
Cut BOM first character for UTF-8 files (for merging two files)
|
|
3305
|
+
@param {string} s Source string
|
|
3306
|
+
@return {string} Replaced string
|
|
3307
|
+
*/
|
|
3308
3308
|
|
|
3309
3309
|
var cutbom = function (s) {
|
|
3310
3310
|
if (s[0] === String.fromCharCode(65279)) {
|
|
@@ -3314,10 +3314,10 @@ var cutbom = function (s) {
|
|
|
3314
3314
|
};
|
|
3315
3315
|
|
|
3316
3316
|
/**
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3317
|
+
Get the global scope
|
|
3318
|
+
Inspired by System.global
|
|
3319
|
+
@return {object} The global scope
|
|
3320
|
+
*/
|
|
3321
3321
|
utils.global = (function () {
|
|
3322
3322
|
if (typeof self !== 'undefined') {
|
|
3323
3323
|
return self;
|
|
@@ -3332,18 +3332,18 @@ utils.global = (function () {
|
|
|
3332
3332
|
})();
|
|
3333
3333
|
|
|
3334
3334
|
/**
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3335
|
+
Find out if a function is native to the enviroment
|
|
3336
|
+
@param {function} Function to check
|
|
3337
|
+
@return {boolean} True if function is native
|
|
3338
|
+
*/
|
|
3339
3339
|
var isNativeFunction = (utils.isNativeFunction = function (fn) {
|
|
3340
3340
|
return typeof fn === 'function' && !!~fn.toString().indexOf('[native code]');
|
|
3341
3341
|
});
|
|
3342
3342
|
|
|
3343
3343
|
/**
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3344
|
+
Find out if code is running in a web worker enviroment
|
|
3345
|
+
@return {boolean} True if code is running in a web worker enviroment
|
|
3346
|
+
*/
|
|
3347
3347
|
utils.isWebWorker = (function () {
|
|
3348
3348
|
try {
|
|
3349
3349
|
var importScripts = utils.global.importScripts;
|
|
@@ -3354,9 +3354,9 @@ utils.isWebWorker = (function () {
|
|
|
3354
3354
|
})();
|
|
3355
3355
|
|
|
3356
3356
|
/**
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3357
|
+
Find out if code is running in a node enviroment
|
|
3358
|
+
@return {boolean} True if code is running in a node enviroment
|
|
3359
|
+
*/
|
|
3360
3360
|
utils.isNode = (function () {
|
|
3361
3361
|
try {
|
|
3362
3362
|
return utils.isNativeFunction(utils.global.process.reallyExit);
|
|
@@ -3366,9 +3366,9 @@ utils.isNode = (function () {
|
|
|
3366
3366
|
})();
|
|
3367
3367
|
|
|
3368
3368
|
/**
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3369
|
+
Find out if code is running in a browser enviroment
|
|
3370
|
+
@return {boolean} True if code is running in a browser enviroment
|
|
3371
|
+
*/
|
|
3372
3372
|
utils.isBrowser = (function () {
|
|
3373
3373
|
try {
|
|
3374
3374
|
return utils.isNativeFunction(utils.global.location.reload);
|
|
@@ -3378,17 +3378,17 @@ utils.isBrowser = (function () {
|
|
|
3378
3378
|
})();
|
|
3379
3379
|
|
|
3380
3380
|
/**
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3381
|
+
Find out if code is running in a browser with a browserify setup
|
|
3382
|
+
@return {boolean} True if code is running in a browser with a browserify setup
|
|
3383
|
+
*/
|
|
3384
3384
|
utils.isBrowserify = (function () {
|
|
3385
3385
|
return utils.isBrowser && typeof process !== 'undefined' && process.browser;
|
|
3386
3386
|
})();
|
|
3387
3387
|
|
|
3388
3388
|
/**
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3389
|
+
Find out if code is running in a browser with a requireJS setup
|
|
3390
|
+
@return {boolean} True if code is running in a browser with a requireJS setup
|
|
3391
|
+
*/
|
|
3392
3392
|
utils.isRequireJS = (function () {
|
|
3393
3393
|
return (
|
|
3394
3394
|
utils.isBrowser && typeof require === 'function' && typeof require.specified === 'function'
|
|
@@ -3396,37 +3396,37 @@ utils.isRequireJS = (function () {
|
|
|
3396
3396
|
})();
|
|
3397
3397
|
|
|
3398
3398
|
/**
|
|
3399
|
-
|
|
3400
|
-
|
|
3399
|
+
Find out if code is running with Meteor in the enviroment
|
|
3400
|
+
@return {boolean} True if code is running with Meteor in the enviroment
|
|
3401
3401
|
|
|
3402
|
-
|
|
3403
|
-
|
|
3402
|
+
@todo Find out if this is the best way to do this
|
|
3403
|
+
*/
|
|
3404
3404
|
utils.isMeteor = (function () {
|
|
3405
3405
|
return typeof Meteor !== 'undefined' && Meteor.release;
|
|
3406
3406
|
})();
|
|
3407
3407
|
|
|
3408
3408
|
/**
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3409
|
+
Find out if code is running on a Meteor client
|
|
3410
|
+
@return {boolean} True if code is running on a Meteor client
|
|
3411
|
+
*/
|
|
3412
3412
|
utils.isMeteorClient = utils.isMeteorClient = (function () {
|
|
3413
3413
|
return utils.isMeteor && Meteor.isClient;
|
|
3414
3414
|
})();
|
|
3415
3415
|
|
|
3416
3416
|
/**
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3417
|
+
Find out if code is running on a Meteor server
|
|
3418
|
+
@return {boolean} True if code is running on a Meteor server
|
|
3419
|
+
*/
|
|
3420
3420
|
utils.isMeteorServer = (function () {
|
|
3421
3421
|
return utils.isMeteor && Meteor.isServer;
|
|
3422
3422
|
})();
|
|
3423
3423
|
|
|
3424
3424
|
/**
|
|
3425
|
-
|
|
3426
|
-
|
|
3425
|
+
Find out code is running in a cordovar enviroment
|
|
3426
|
+
@return {boolean} True if code is running in a web worker enviroment
|
|
3427
3427
|
|
|
3428
|
-
|
|
3429
|
-
|
|
3428
|
+
@todo Find out if this is the best way to do this
|
|
3429
|
+
*/
|
|
3430
3430
|
utils.isCordova = (function () {
|
|
3431
3431
|
return typeof cordova === 'object';
|
|
3432
3432
|
})();
|
|
@@ -3453,16 +3453,16 @@ utils.isArray = function (obj) {
|
|
|
3453
3453
|
return '[object Array]' === Object.prototype.toString.call(obj);
|
|
3454
3454
|
};
|
|
3455
3455
|
/**
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3456
|
+
Load text file from anywhere
|
|
3457
|
+
@param {string|object} path File path or HTML event
|
|
3458
|
+
@param {boolean} asy True - async call, false - sync call
|
|
3459
|
+
@param {function} success Success function
|
|
3460
|
+
@param {function} error Error function
|
|
3461
|
+
@return {string} Read data
|
|
3462
|
+
|
|
3463
|
+
@todo Define Event type
|
|
3464
|
+
@todo Smaller if-else structures.
|
|
3465
|
+
*/
|
|
3466
3466
|
var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
3467
3467
|
var data, fs;
|
|
3468
3468
|
if (utils.isNode || utils.isMeteorServer) {
|
|
@@ -3484,13 +3484,18 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3484
3484
|
});
|
|
3485
3485
|
} else {
|
|
3486
3486
|
if (/^[a-z]+:\/\//i.test(path)) {
|
|
3487
|
-
var
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3487
|
+
var fetch = require('node-fetch');
|
|
3488
|
+
fetch(path)
|
|
3489
|
+
.then((response) => response.arrayBuffer())
|
|
3490
|
+
.then((buf) => {
|
|
3491
|
+
var a = new Uint8Array(buf);
|
|
3492
|
+
var b = [...a].map((e) => String.fromCharCode(e)).join('');
|
|
3493
|
+
success(cutbom(b));
|
|
3494
|
+
})["catch"]((e) => {
|
|
3495
|
+
if (error) return error(e);
|
|
3496
|
+
console.error(e);
|
|
3497
|
+
throw e;
|
|
3498
|
+
});
|
|
3494
3499
|
} else {
|
|
3495
3500
|
//If async callthen call async
|
|
3496
3501
|
if (asy) {
|
|
@@ -3542,16 +3547,16 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3542
3547
|
if (typeof path === 'string') {
|
|
3543
3548
|
// For browser read from tag
|
|
3544
3549
|
/*
|
|
3545
|
-
|
|
3546
|
-
|
|
3550
|
+
SELECT * FROM TXT('#one') -- read data from HTML element with id="one"
|
|
3551
|
+
*/
|
|
3547
3552
|
if (path.substr(0, 1) === '#' && typeof document !== 'undefined') {
|
|
3548
3553
|
data = document.querySelector(path).textContent;
|
|
3549
3554
|
success(data);
|
|
3550
3555
|
} else {
|
|
3551
3556
|
/*
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3557
|
+
Simply read file from HTTP request, like:
|
|
3558
|
+
SELECT * FROM TXT('http://alasql.org/README.md');
|
|
3559
|
+
*/
|
|
3555
3560
|
var xhr = new XMLHttpRequest();
|
|
3556
3561
|
xhr.onreadystatechange = function () {
|
|
3557
3562
|
if (xhr.readyState === 4) {
|
|
@@ -3571,14 +3576,14 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3571
3576
|
}
|
|
3572
3577
|
} else if (path instanceof Event) {
|
|
3573
3578
|
/*
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3579
|
+
For browser read from files input element
|
|
3580
|
+
<input type="files" onchange="readFile(event)">
|
|
3581
|
+
<script>
|
|
3582
|
+
function readFile(event) {
|
|
3583
|
+
alasql('SELECT * FROM TXT(?)',[event])
|
|
3584
|
+
}
|
|
3585
|
+
</script>
|
|
3586
|
+
*/
|
|
3582
3587
|
/** @type {array} List of files from <input> element */
|
|
3583
3588
|
var files = path.target.files;
|
|
3584
3589
|
/** type {object} */
|
|
@@ -3595,15 +3600,15 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3595
3600
|
});
|
|
3596
3601
|
|
|
3597
3602
|
/**
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3603
|
+
@function Load binary file from anywhere
|
|
3604
|
+
@param {string} path File path
|
|
3605
|
+
@param {boolean} asy True - async call, false - sync call
|
|
3606
|
+
@param {function} success Success function
|
|
3607
|
+
@param {function} error Error function
|
|
3608
|
+
@return 1 for Async, data - for sync version
|
|
3609
|
+
|
|
3610
|
+
@todo merge functionality from loadFile and LoadBinaryFile
|
|
3611
|
+
*/
|
|
3607
3612
|
|
|
3608
3613
|
var loadBinaryFile = (utils.loadBinaryFile = function (
|
|
3609
3614
|
path,
|
|
@@ -3619,17 +3624,18 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
|
|
|
3619
3624
|
fs = require('fs');
|
|
3620
3625
|
|
|
3621
3626
|
if (/^[a-z]+:\/\//i.test(path)) {
|
|
3622
|
-
var
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3627
|
+
var fetch = require('node-fetch');
|
|
3628
|
+
fetch(path)
|
|
3629
|
+
.then((response) => response.arrayBuffer())
|
|
3630
|
+
.then((buf) => {
|
|
3631
|
+
var a = new Uint8Array(buf);
|
|
3632
|
+
var b = [...a].map((e) => String.fromCharCode(e)).join('');
|
|
3633
|
+
success(b);
|
|
3634
|
+
})["catch"]((e) => {
|
|
3635
|
+
if (error) return error(e);
|
|
3636
|
+
console.error(e);
|
|
3637
|
+
throw e;
|
|
3638
|
+
});
|
|
3633
3639
|
} else {
|
|
3634
3640
|
if (runAsync) {
|
|
3635
3641
|
fs.readFile(path, function (err, data) {
|
|
@@ -3802,12 +3808,12 @@ var fileExists = (utils.fileExists = function (path, cb) {
|
|
|
3802
3808
|
});
|
|
3803
3809
|
|
|
3804
3810
|
/**
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
+
Save text file from anywhere
|
|
3812
|
+
@param {string} path File path
|
|
3813
|
+
@param {array} data Data object
|
|
3814
|
+
@param {function} cb Callback
|
|
3815
|
+
@param {object=} opts
|
|
3816
|
+
*/
|
|
3811
3817
|
|
|
3812
3818
|
var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
3813
3819
|
var res = 1;
|
|
@@ -3889,21 +3895,21 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
|
3889
3895
|
});
|
|
3890
3896
|
|
|
3891
3897
|
/**
|
|
3892
|
-
|
|
3893
|
-
|
|
3898
|
+
@function Is this IE9
|
|
3899
|
+
@return {boolean} True for IE9 and false for other browsers
|
|
3894
3900
|
|
|
3895
|
-
|
|
3896
|
-
|
|
3901
|
+
For IE9 compatibility issues
|
|
3902
|
+
*/
|
|
3897
3903
|
function isIE() {
|
|
3898
3904
|
var myNav = navigator.userAgent.toLowerCase();
|
|
3899
3905
|
return myNav.indexOf('msie') !== -1 ? parseInt(myNav.split('msie')[1]) : false;
|
|
3900
3906
|
}
|
|
3901
3907
|
|
|
3902
3908
|
/**
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3909
|
+
@function Hash a string to signed integer
|
|
3910
|
+
@param {string} source string
|
|
3911
|
+
@return {integer} hash number
|
|
3912
|
+
*/
|
|
3907
3913
|
|
|
3908
3914
|
// FNV-1a inspired hashing
|
|
3909
3915
|
var hash = (utils.hash = function (str) {
|
|
@@ -3917,12 +3923,12 @@ var hash = (utils.hash = function (str) {
|
|
|
3917
3923
|
});
|
|
3918
3924
|
|
|
3919
3925
|
/**
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
+
Union arrays
|
|
3927
|
+
@function
|
|
3928
|
+
@param {array} a
|
|
3929
|
+
@param {array} b
|
|
3930
|
+
@return {array}
|
|
3931
|
+
*/
|
|
3926
3932
|
var arrayUnion = (utils.arrayUnion = function (a, b) {
|
|
3927
3933
|
var r = b.slice(0);
|
|
3928
3934
|
a.forEach(function (i) {
|
|
@@ -3934,8 +3940,8 @@ var arrayUnion = (utils.arrayUnion = function (a, b) {
|
|
|
3934
3940
|
});
|
|
3935
3941
|
|
|
3936
3942
|
/**
|
|
3937
|
-
|
|
3938
|
-
|
|
3943
|
+
Array Difference
|
|
3944
|
+
*/
|
|
3939
3945
|
var arrayDiff = (utils.arrayDiff = function (a, b) {
|
|
3940
3946
|
return a.filter(function (i) {
|
|
3941
3947
|
return b.indexOf(i) < 0;
|
|
@@ -3943,8 +3949,8 @@ var arrayDiff = (utils.arrayDiff = function (a, b) {
|
|
|
3943
3949
|
});
|
|
3944
3950
|
|
|
3945
3951
|
/**
|
|
3946
|
-
|
|
3947
|
-
|
|
3952
|
+
Arrays deep intersect (with records)
|
|
3953
|
+
*/
|
|
3948
3954
|
var arrayIntersect = (utils.arrayIntersect = function (a, b) {
|
|
3949
3955
|
var r = [];
|
|
3950
3956
|
a.forEach(function (ai) {
|
|
@@ -3962,8 +3968,8 @@ var arrayIntersect = (utils.arrayIntersect = function (a, b) {
|
|
|
3962
3968
|
});
|
|
3963
3969
|
|
|
3964
3970
|
/**
|
|
3965
|
-
|
|
3966
|
-
|
|
3971
|
+
Arrays deep union (with records)
|
|
3972
|
+
*/
|
|
3967
3973
|
var arrayUnionDeep = (utils.arrayUnionDeep = function (a, b) {
|
|
3968
3974
|
var r = b.slice(0);
|
|
3969
3975
|
a.forEach(function (ai) {
|
|
@@ -3982,8 +3988,8 @@ var arrayUnionDeep = (utils.arrayUnionDeep = function (a, b) {
|
|
|
3982
3988
|
});
|
|
3983
3989
|
|
|
3984
3990
|
/**
|
|
3985
|
-
|
|
3986
|
-
|
|
3991
|
+
Arrays deep union (with records)
|
|
3992
|
+
*/
|
|
3987
3993
|
var arrayExceptDeep = (utils.arrayExceptDeep = function (a, b) {
|
|
3988
3994
|
var r = [];
|
|
3989
3995
|
a.forEach(function (ai) {
|
|
@@ -4002,8 +4008,8 @@ var arrayExceptDeep = (utils.arrayExceptDeep = function (a, b) {
|
|
|
4002
4008
|
});
|
|
4003
4009
|
|
|
4004
4010
|
/**
|
|
4005
|
-
|
|
4006
|
-
|
|
4011
|
+
Arrays deep intersect (with records)
|
|
4012
|
+
*/
|
|
4007
4013
|
var arrayIntersectDeep = (utils.arrayIntersectDeep = function (a, b) {
|
|
4008
4014
|
var r = [];
|
|
4009
4015
|
a.forEach(function (ai) {
|
|
@@ -4022,8 +4028,8 @@ var arrayIntersectDeep = (utils.arrayIntersectDeep = function (a, b) {
|
|
|
4022
4028
|
});
|
|
4023
4029
|
|
|
4024
4030
|
/**
|
|
4025
|
-
|
|
4026
|
-
|
|
4031
|
+
Deep clone objects
|
|
4032
|
+
*/
|
|
4027
4033
|
var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
4028
4034
|
if (null === obj || typeof obj !== 'object') {
|
|
4029
4035
|
return obj;
|
|
@@ -4052,12 +4058,12 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4052
4058
|
});
|
|
4053
4059
|
|
|
4054
4060
|
/**
|
|
4055
|
-
|
|
4056
|
-
|
|
4061
|
+
Check equality of objects
|
|
4062
|
+
*/
|
|
4057
4063
|
|
|
4058
4064
|
/**
|
|
4059
|
-
|
|
4060
|
-
|
|
4065
|
+
Compare two objects in deep
|
|
4066
|
+
*/
|
|
4061
4067
|
var deepEqual = (utils.deepEqual = function (x, y) {
|
|
4062
4068
|
if (x === y) {
|
|
4063
4069
|
return true;
|
|
@@ -4078,10 +4084,10 @@ var deepEqual = (utils.deepEqual = function (x, y) {
|
|
|
4078
4084
|
return false;
|
|
4079
4085
|
});
|
|
4080
4086
|
/**
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4087
|
+
Array with distinct records
|
|
4088
|
+
@param {array} data
|
|
4089
|
+
@return {array}
|
|
4090
|
+
*/
|
|
4085
4091
|
var distinctArray = (utils.distinctArray = function (data) {
|
|
4086
4092
|
var uniq = {};
|
|
4087
4093
|
// TODO: Speedup, because Object.keys is slow
|
|
@@ -4107,12 +4113,12 @@ var distinctArray = (utils.distinctArray = function (data) {
|
|
|
4107
4113
|
});
|
|
4108
4114
|
|
|
4109
4115
|
/**
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
+
Extend object a with properties of b
|
|
4117
|
+
@function
|
|
4118
|
+
@param {object} a
|
|
4119
|
+
@param {object} b
|
|
4120
|
+
@return {object}
|
|
4121
|
+
*/
|
|
4116
4122
|
var extend = (utils.extend = function extend(a, b) {
|
|
4117
4123
|
a = a || {};
|
|
4118
4124
|
for (var key in b) {
|
|
@@ -4133,8 +4139,8 @@ var getValueOf = (utils.getValueOf = function (val) {
|
|
|
4133
4139
|
});
|
|
4134
4140
|
|
|
4135
4141
|
/**
|
|
4136
|
-
|
|
4137
|
-
|
|
4142
|
+
Flat array by first row
|
|
4143
|
+
*/
|
|
4138
4144
|
var flatArray = (utils.flatArray = function (a) {
|
|
4139
4145
|
|
|
4140
4146
|
if (!a || 0 === a.length) {
|
|
@@ -4158,8 +4164,8 @@ var flatArray = (utils.flatArray = function (a) {
|
|
|
4158
4164
|
});
|
|
4159
4165
|
|
|
4160
4166
|
/**
|
|
4161
|
-
|
|
4162
|
-
|
|
4167
|
+
Convert array of objects to array of arrays
|
|
4168
|
+
*/
|
|
4163
4169
|
var arrayOfArrays = (utils.arrayOfArrays = function (a) {
|
|
4164
4170
|
return a.map(function (aa) {
|
|
4165
4171
|
var ar = [];
|
|
@@ -4177,12 +4183,18 @@ if (!Array.isArray) {
|
|
|
4177
4183
|
}
|
|
4178
4184
|
|
|
4179
4185
|
/**
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4186
|
+
Excel:convert number to Excel column, like 1 => 'A'
|
|
4187
|
+
@param {integer} i Column number, starting with 0
|
|
4188
|
+
@return {string} Column name, starting with 'A'
|
|
4189
|
+
*/
|
|
4184
4190
|
|
|
4185
4191
|
var xlsnc = (utils.xlsnc = function (i) {
|
|
4192
|
+
var first = '';
|
|
4193
|
+
if (i > 701) {
|
|
4194
|
+
let x = (((i - 26) / (26 * 26)) | 0) - 1;
|
|
4195
|
+
first = String.fromCharCode(65 + (x % 26));
|
|
4196
|
+
i = i % (26 * 26);
|
|
4197
|
+
}
|
|
4186
4198
|
var addr = String.fromCharCode(65 + (i % 26));
|
|
4187
4199
|
if (i >= 26) {
|
|
4188
4200
|
i = ((i / 26) | 0) - 1;
|
|
@@ -4192,14 +4204,14 @@ var xlsnc = (utils.xlsnc = function (i) {
|
|
|
4192
4204
|
addr = String.fromCharCode(65 + (i % 26)) + addr;
|
|
4193
4205
|
}
|
|
4194
4206
|
}
|
|
4195
|
-
return addr;
|
|
4207
|
+
return first + addr;
|
|
4196
4208
|
});
|
|
4197
4209
|
|
|
4198
4210
|
/**
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4211
|
+
Excel:conver Excel column name to number
|
|
4212
|
+
@param {string} s Column number, like 'A' or 'BE'
|
|
4213
|
+
@return {string} Column name, starting with 0
|
|
4214
|
+
*/
|
|
4203
4215
|
var xlscn = (utils.xlscn = function (s) {
|
|
4204
4216
|
var n = s.charCodeAt(0) - 65;
|
|
4205
4217
|
if (s.length > 1) {
|
|
@@ -4220,12 +4232,12 @@ var domEmptyChildren = (utils.domEmptyChildren = function (container) {
|
|
|
4220
4232
|
});
|
|
4221
4233
|
|
|
4222
4234
|
/**
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4235
|
+
SQL LIKE emulation
|
|
4236
|
+
@parameter {string} pattern Search pattern
|
|
4237
|
+
@parameter {string} value Searched value
|
|
4238
|
+
@parameter {string} escape Escape character (optional)
|
|
4239
|
+
@return {boolean} If value LIKE pattern ESCAPE escape
|
|
4240
|
+
*/
|
|
4229
4241
|
|
|
4230
4242
|
var like = (utils.like = function (pattern, value, escape) {
|
|
4231
4243
|
// Verify escape character
|
|
@@ -4296,9 +4308,9 @@ utils.glob = function (value, pattern) {
|
|
|
4296
4308
|
};
|
|
4297
4309
|
|
|
4298
4310
|
/**
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4311
|
+
Get path of alasql.js
|
|
4312
|
+
@todo Rewrite and simplify the code. Review, is this function is required separately
|
|
4313
|
+
*/
|
|
4302
4314
|
utils.findAlaSQLPath = function () {
|
|
4303
4315
|
/** type {string} Path to alasql library and plugins */
|
|
4304
4316
|
|
|
@@ -4842,422 +4854,7 @@ alasql.compile = function (sql, databaseid) {
|
|
|
4842
4854
|
//
|
|
4843
4855
|
|
|
4844
4856
|
if (!utils.global.Promise) {
|
|
4845
|
-
|
|
4846
|
-
/*not-for-browser/*
|
|
4847
|
-
utils.global.Promise = require('es6-promise').Promise;
|
|
4848
|
-
//*/
|
|
4849
|
-
} else {
|
|
4850
|
-
/*!
|
|
4851
|
-
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
4852
|
-
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
4853
|
-
* @license Licensed under MIT license
|
|
4854
|
-
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
|
|
4855
|
-
* @version 3.2.1
|
|
4856
|
-
*/
|
|
4857
|
-
(function () {
|
|
4858
|
-
'use strict';
|
|
4859
|
-
function t(t) {
|
|
4860
|
-
return 'function' == typeof t || ('object' == typeof t && null !== t);
|
|
4861
|
-
}
|
|
4862
|
-
function e(t) {
|
|
4863
|
-
return 'function' == typeof t;
|
|
4864
|
-
}
|
|
4865
|
-
function n(t) {
|
|
4866
|
-
G = t;
|
|
4867
|
-
}
|
|
4868
|
-
function r(t) {
|
|
4869
|
-
Q = t;
|
|
4870
|
-
}
|
|
4871
|
-
function o() {
|
|
4872
|
-
return function () {
|
|
4873
|
-
process.nextTick(a);
|
|
4874
|
-
};
|
|
4875
|
-
}
|
|
4876
|
-
function i() {
|
|
4877
|
-
return function () {
|
|
4878
|
-
B(a);
|
|
4879
|
-
};
|
|
4880
|
-
}
|
|
4881
|
-
function s() {
|
|
4882
|
-
var t = 0,
|
|
4883
|
-
e = new X(a),
|
|
4884
|
-
n = document.createTextNode('');
|
|
4885
|
-
return (
|
|
4886
|
-
e.observe(n, {characterData: !0}),
|
|
4887
|
-
function () {
|
|
4888
|
-
n.data = t = ++t % 2;
|
|
4889
|
-
}
|
|
4890
|
-
);
|
|
4891
|
-
}
|
|
4892
|
-
function u() {
|
|
4893
|
-
var t = new MessageChannel();
|
|
4894
|
-
return (
|
|
4895
|
-
(t.port1.onmessage = a),
|
|
4896
|
-
function () {
|
|
4897
|
-
t.port2.postMessage(0);
|
|
4898
|
-
}
|
|
4899
|
-
);
|
|
4900
|
-
}
|
|
4901
|
-
function c() {
|
|
4902
|
-
return function () {
|
|
4903
|
-
setTimeout(a, 1);
|
|
4904
|
-
};
|
|
4905
|
-
}
|
|
4906
|
-
function a() {
|
|
4907
|
-
for (var t = 0; J > t; t += 2) {
|
|
4908
|
-
var e = tt[t],
|
|
4909
|
-
n = tt[t + 1];
|
|
4910
|
-
e(n), (tt[t] = void 0), (tt[t + 1] = void 0);
|
|
4911
|
-
}
|
|
4912
|
-
J = 0;
|
|
4913
|
-
}
|
|
4914
|
-
function f() {
|
|
4915
|
-
try {
|
|
4916
|
-
var t = require,
|
|
4917
|
-
e = t('vertx');
|
|
4918
|
-
return (B = e.runOnLoop || e.runOnContext, i());
|
|
4919
|
-
} catch (n) {
|
|
4920
|
-
return c();
|
|
4921
|
-
}
|
|
4922
|
-
}
|
|
4923
|
-
function l(t, e) {
|
|
4924
|
-
var n = this,
|
|
4925
|
-
r = new this.constructor(p);
|
|
4926
|
-
void 0 === r[rt] && k(r);
|
|
4927
|
-
var o = n._state;
|
|
4928
|
-
if (o) {
|
|
4929
|
-
var i = arguments[o - 1];
|
|
4930
|
-
Q(function () {
|
|
4931
|
-
x(o, r, i, n._result);
|
|
4932
|
-
});
|
|
4933
|
-
} else E(n, r, t, e);
|
|
4934
|
-
return r;
|
|
4935
|
-
}
|
|
4936
|
-
function h(t) {
|
|
4937
|
-
var e = this;
|
|
4938
|
-
if (t && 'object' == typeof t && t.constructor === e) return t;
|
|
4939
|
-
var n = new e(p);
|
|
4940
|
-
return (g(n, t), n);
|
|
4941
|
-
}
|
|
4942
|
-
function p() {}
|
|
4943
|
-
function _() {
|
|
4944
|
-
return new TypeError('You cannot resolve a promise with itself');
|
|
4945
|
-
}
|
|
4946
|
-
function d() {
|
|
4947
|
-
return new TypeError('A promises callback cannot return that same promise.');
|
|
4948
|
-
}
|
|
4949
|
-
function v(t) {
|
|
4950
|
-
try {
|
|
4951
|
-
return t.then;
|
|
4952
|
-
} catch (e) {
|
|
4953
|
-
return (ut.error = e, ut);
|
|
4954
|
-
}
|
|
4955
|
-
}
|
|
4956
|
-
function y(t, e, n, r) {
|
|
4957
|
-
try {
|
|
4958
|
-
t.call(e, n, r);
|
|
4959
|
-
} catch (o) {
|
|
4960
|
-
return o;
|
|
4961
|
-
}
|
|
4962
|
-
}
|
|
4963
|
-
function m(t, e, n) {
|
|
4964
|
-
Q(function (t) {
|
|
4965
|
-
var r = !1,
|
|
4966
|
-
o = y(
|
|
4967
|
-
n,
|
|
4968
|
-
e,
|
|
4969
|
-
function (n) {
|
|
4970
|
-
r || ((r = !0), e !== n ? g(t, n) : S(t, n));
|
|
4971
|
-
},
|
|
4972
|
-
function (e) {
|
|
4973
|
-
r || ((r = !0), j(t, e));
|
|
4974
|
-
},
|
|
4975
|
-
'Settle: ' + (t._label || ' unknown promise')
|
|
4976
|
-
);
|
|
4977
|
-
!r && o && ((r = !0), j(t, o));
|
|
4978
|
-
}, t);
|
|
4979
|
-
}
|
|
4980
|
-
function b(t, e) {
|
|
4981
|
-
e._state === it
|
|
4982
|
-
? S(t, e._result)
|
|
4983
|
-
: e._state === st
|
|
4984
|
-
? j(t, e._result)
|
|
4985
|
-
: E(
|
|
4986
|
-
e,
|
|
4987
|
-
void 0,
|
|
4988
|
-
function (e) {
|
|
4989
|
-
g(t, e);
|
|
4990
|
-
},
|
|
4991
|
-
function (e) {
|
|
4992
|
-
j(t, e);
|
|
4993
|
-
}
|
|
4994
|
-
);
|
|
4995
|
-
}
|
|
4996
|
-
function w(t, n, r) {
|
|
4997
|
-
n.constructor === t.constructor && r === et && constructor.resolve === nt
|
|
4998
|
-
? b(t, n)
|
|
4999
|
-
: r === ut
|
|
5000
|
-
? j(t, ut.error)
|
|
5001
|
-
: void 0 === r
|
|
5002
|
-
? S(t, n)
|
|
5003
|
-
: e(r)
|
|
5004
|
-
? m(t, n, r)
|
|
5005
|
-
: S(t, n);
|
|
5006
|
-
}
|
|
5007
|
-
function g(e, n) {
|
|
5008
|
-
e === n ? j(e, _()) : t(n) ? w(e, n, v(n)) : S(e, n);
|
|
5009
|
-
}
|
|
5010
|
-
function A(t) {
|
|
5011
|
-
t._onerror && t._onerror(t._result), T(t);
|
|
5012
|
-
}
|
|
5013
|
-
function S(t, e) {
|
|
5014
|
-
t._state === ot &&
|
|
5015
|
-
((t._result = e), (t._state = it), 0 !== t._subscribers.length && Q(T, t));
|
|
5016
|
-
}
|
|
5017
|
-
function j(t, e) {
|
|
5018
|
-
t._state === ot && ((t._state = st), (t._result = e), Q(A, t));
|
|
5019
|
-
}
|
|
5020
|
-
function E(t, e, n, r) {
|
|
5021
|
-
var o = t._subscribers,
|
|
5022
|
-
i = o.length;
|
|
5023
|
-
(t._onerror = null),
|
|
5024
|
-
(o[i] = e),
|
|
5025
|
-
(o[i + it] = n),
|
|
5026
|
-
(o[i + st] = r),
|
|
5027
|
-
0 === i && t._state && Q(T, t);
|
|
5028
|
-
}
|
|
5029
|
-
function T(t) {
|
|
5030
|
-
var e = t._subscribers,
|
|
5031
|
-
n = t._state;
|
|
5032
|
-
if (0 !== e.length) {
|
|
5033
|
-
for (var r, o, i = t._result, s = 0; s < e.length; s += 3)
|
|
5034
|
-
(r = e[s]), (o = e[s + n]), r ? x(n, r, o, i) : o(i);
|
|
5035
|
-
t._subscribers.length = 0;
|
|
5036
|
-
}
|
|
5037
|
-
}
|
|
5038
|
-
function M() {
|
|
5039
|
-
this.error = null;
|
|
5040
|
-
}
|
|
5041
|
-
function P(t, e) {
|
|
5042
|
-
try {
|
|
5043
|
-
return t(e);
|
|
5044
|
-
} catch (n) {
|
|
5045
|
-
return (ct.error = n, ct);
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
function x(t, n, r, o) {
|
|
5049
|
-
var i,
|
|
5050
|
-
s,
|
|
5051
|
-
u,
|
|
5052
|
-
c,
|
|
5053
|
-
a = e(r);
|
|
5054
|
-
if (a) {
|
|
5055
|
-
if (((i = P(r, o)), i === ct ? ((c = !0), (s = i.error), (i = null)) : (u = !0), n === i))
|
|
5056
|
-
return void j(n, d());
|
|
5057
|
-
} else (i = o), (u = !0);
|
|
5058
|
-
n._state !== ot ||
|
|
5059
|
-
(a && u ? g(n, i) : c ? j(n, s) : t === it ? S(n, i) : t === st && j(n, i));
|
|
5060
|
-
}
|
|
5061
|
-
function C(t, e) {
|
|
5062
|
-
try {
|
|
5063
|
-
e(
|
|
5064
|
-
function (e) {
|
|
5065
|
-
g(t, e);
|
|
5066
|
-
},
|
|
5067
|
-
function (e) {
|
|
5068
|
-
j(t, e);
|
|
5069
|
-
}
|
|
5070
|
-
);
|
|
5071
|
-
} catch (n) {
|
|
5072
|
-
j(t, n);
|
|
5073
|
-
}
|
|
5074
|
-
}
|
|
5075
|
-
function O() {
|
|
5076
|
-
return at++;
|
|
5077
|
-
}
|
|
5078
|
-
function k(t) {
|
|
5079
|
-
(t[rt] = at++), (t._state = void 0), (t._result = void 0), (t._subscribers = []);
|
|
5080
|
-
}
|
|
5081
|
-
function Y(t) {
|
|
5082
|
-
return new _t(this, t).promise;
|
|
5083
|
-
}
|
|
5084
|
-
function q(t) {
|
|
5085
|
-
var e = this;
|
|
5086
|
-
return new e(
|
|
5087
|
-
I(t)
|
|
5088
|
-
? function (n, r) {
|
|
5089
|
-
for (var o = t.length, i = 0; o > i; i++) e.resolve(t[i]).then(n, r);
|
|
5090
|
-
}
|
|
5091
|
-
: function (t, e) {
|
|
5092
|
-
e(new TypeError('You must pass an array to race.'));
|
|
5093
|
-
}
|
|
5094
|
-
);
|
|
5095
|
-
}
|
|
5096
|
-
function F(t) {
|
|
5097
|
-
var e = this,
|
|
5098
|
-
n = new e(p);
|
|
5099
|
-
return (j(n, t), n);
|
|
5100
|
-
}
|
|
5101
|
-
function D() {
|
|
5102
|
-
throw new TypeError(
|
|
5103
|
-
'You must pass a resolver function as the first argument to the promise constructor'
|
|
5104
|
-
);
|
|
5105
|
-
}
|
|
5106
|
-
function K() {
|
|
5107
|
-
throw new TypeError(
|
|
5108
|
-
"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."
|
|
5109
|
-
);
|
|
5110
|
-
}
|
|
5111
|
-
function L(t) {
|
|
5112
|
-
(this[rt] = O()),
|
|
5113
|
-
(this._result = this._state = void 0),
|
|
5114
|
-
(this._subscribers = []),
|
|
5115
|
-
p !== t && ('function' != typeof t && D(), this instanceof L ? C(this, t) : K());
|
|
5116
|
-
}
|
|
5117
|
-
function N(t, e) {
|
|
5118
|
-
(this._instanceConstructor = t),
|
|
5119
|
-
(this.promise = new t(p)),
|
|
5120
|
-
this.promise[rt] || k(this.promise),
|
|
5121
|
-
Array.isArray(e)
|
|
5122
|
-
? ((this._input = e),
|
|
5123
|
-
(this.length = e.length),
|
|
5124
|
-
(this._remaining = e.length),
|
|
5125
|
-
(this._result = new Array(this.length)),
|
|
5126
|
-
0 === this.length
|
|
5127
|
-
? S(this.promise, this._result)
|
|
5128
|
-
: ((this.length = this.length || 0),
|
|
5129
|
-
this._enumerate(),
|
|
5130
|
-
0 === this._remaining && S(this.promise, this._result)))
|
|
5131
|
-
: j(this.promise, U());
|
|
5132
|
-
}
|
|
5133
|
-
function U() {
|
|
5134
|
-
return new Error('Array Methods must be provided an Array');
|
|
5135
|
-
}
|
|
5136
|
-
function W() {
|
|
5137
|
-
var t;
|
|
5138
|
-
if ('undefined' != typeof global) t = global;
|
|
5139
|
-
else if ('undefined' != typeof self) t = self;
|
|
5140
|
-
else
|
|
5141
|
-
try {
|
|
5142
|
-
t = Function('return this')();
|
|
5143
|
-
} catch (e) {
|
|
5144
|
-
throw new Error(
|
|
5145
|
-
'polyfill failed because global object is unavailable in this environment'
|
|
5146
|
-
);
|
|
5147
|
-
}
|
|
5148
|
-
var n = t.Promise;
|
|
5149
|
-
(!n || '[object Promise]' !== Object.prototype.toString.call(n.resolve()) || n.cast) &&
|
|
5150
|
-
(t.Promise = pt);
|
|
5151
|
-
}
|
|
5152
|
-
var z;
|
|
5153
|
-
z = Array.isArray
|
|
5154
|
-
? Array.isArray
|
|
5155
|
-
: function (t) {
|
|
5156
|
-
return '[object Array]' === Object.prototype.toString.call(t);
|
|
5157
|
-
};
|
|
5158
|
-
var B,
|
|
5159
|
-
G,
|
|
5160
|
-
H,
|
|
5161
|
-
I = z,
|
|
5162
|
-
J = 0,
|
|
5163
|
-
Q = function (t, e) {
|
|
5164
|
-
(tt[J] = t), (tt[J + 1] = e), (J += 2), 2 === J && (G ? G(a) : H());
|
|
5165
|
-
},
|
|
5166
|
-
R = 'undefined' != typeof window ? window : void 0,
|
|
5167
|
-
V = R || {},
|
|
5168
|
-
X = V.MutationObserver || V.WebKitMutationObserver,
|
|
5169
|
-
Z =
|
|
5170
|
-
'undefined' == typeof self &&
|
|
5171
|
-
'undefined' != typeof process &&
|
|
5172
|
-
'[object process]' === {}.toString.call(process),
|
|
5173
|
-
$ =
|
|
5174
|
-
'undefined' != typeof Uint8ClampedArray &&
|
|
5175
|
-
'undefined' != typeof importScripts &&
|
|
5176
|
-
'undefined' != typeof MessageChannel,
|
|
5177
|
-
tt = new Array(1e3);
|
|
5178
|
-
H = Z ? o() : X ? s() : $ ? u() : void 0 === R && 'function' == typeof require ? f() : c();
|
|
5179
|
-
var et = l,
|
|
5180
|
-
nt = h,
|
|
5181
|
-
rt = Math.random().toString(36).substring(16),
|
|
5182
|
-
ot = void 0,
|
|
5183
|
-
it = 1,
|
|
5184
|
-
st = 2,
|
|
5185
|
-
ut = new M(),
|
|
5186
|
-
ct = new M(),
|
|
5187
|
-
at = 0,
|
|
5188
|
-
ft = Y,
|
|
5189
|
-
lt = q,
|
|
5190
|
-
ht = F,
|
|
5191
|
-
pt = L;
|
|
5192
|
-
(L.all = ft),
|
|
5193
|
-
(L.race = lt),
|
|
5194
|
-
(L.resolve = nt),
|
|
5195
|
-
(L.reject = ht),
|
|
5196
|
-
(L._setScheduler = n),
|
|
5197
|
-
(L._setAsap = r),
|
|
5198
|
-
(L._asap = Q),
|
|
5199
|
-
(L.prototype = {
|
|
5200
|
-
constructor: L,
|
|
5201
|
-
then: et,
|
|
5202
|
-
"catch": function (t) {
|
|
5203
|
-
return this.then(null, t);
|
|
5204
|
-
},
|
|
5205
|
-
});
|
|
5206
|
-
var _t = N;
|
|
5207
|
-
(N.prototype._enumerate = function () {
|
|
5208
|
-
for (var t = this.length, e = this._input, n = 0; this._state === ot && t > n; n++)
|
|
5209
|
-
this._eachEntry(e[n], n);
|
|
5210
|
-
}),
|
|
5211
|
-
(N.prototype._eachEntry = function (t, e) {
|
|
5212
|
-
var n = this._instanceConstructor,
|
|
5213
|
-
r = n.resolve;
|
|
5214
|
-
if (r === nt) {
|
|
5215
|
-
var o = v(t);
|
|
5216
|
-
if (o === et && t._state !== ot) this._settledAt(t._state, e, t._result);
|
|
5217
|
-
else if ('function' != typeof o) this._remaining--, (this._result[e] = t);
|
|
5218
|
-
else if (n === pt) {
|
|
5219
|
-
var i = new n(p);
|
|
5220
|
-
w(i, t, o), this._willSettleAt(i, e);
|
|
5221
|
-
} else
|
|
5222
|
-
this._willSettleAt(
|
|
5223
|
-
new n(function (e) {
|
|
5224
|
-
e(t);
|
|
5225
|
-
}),
|
|
5226
|
-
e
|
|
5227
|
-
);
|
|
5228
|
-
} else this._willSettleAt(r(t), e);
|
|
5229
|
-
}),
|
|
5230
|
-
(N.prototype._settledAt = function (t, e, n) {
|
|
5231
|
-
var r = this.promise;
|
|
5232
|
-
r._state === ot && (this._remaining--, t === st ? j(r, n) : (this._result[e] = n)),
|
|
5233
|
-
0 === this._remaining && S(r, this._result);
|
|
5234
|
-
}),
|
|
5235
|
-
(N.prototype._willSettleAt = function (t, e) {
|
|
5236
|
-
var n = this;
|
|
5237
|
-
E(
|
|
5238
|
-
t,
|
|
5239
|
-
void 0,
|
|
5240
|
-
function (t) {
|
|
5241
|
-
n._settledAt(it, e, t);
|
|
5242
|
-
},
|
|
5243
|
-
function (t) {
|
|
5244
|
-
n._settledAt(st, e, t);
|
|
5245
|
-
}
|
|
5246
|
-
);
|
|
5247
|
-
});
|
|
5248
|
-
var dt = W,
|
|
5249
|
-
vt = {Promise: pt, polyfill: dt};
|
|
5250
|
-
'function' == typeof define && define.amd
|
|
5251
|
-
? define(function () {
|
|
5252
|
-
return vt;
|
|
5253
|
-
})
|
|
5254
|
-
: 'undefined' != typeof module && module.exports
|
|
5255
|
-
? (module.exports = vt)
|
|
5256
|
-
: 'undefined' != typeof this && (this.ES6Promise = vt),
|
|
5257
|
-
dt();
|
|
5258
|
-
}.call(this));
|
|
5259
|
-
|
|
5260
|
-
}
|
|
4857
|
+
utils.global.Promise = Promise;
|
|
5261
4858
|
}
|
|
5262
4859
|
|
|
5263
4860
|
var promiseExec = function (sql, params, counterStep, counterTotal) {
|
|
@@ -15708,10 +15305,6 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
15708
15305
|
return res;
|
|
15709
15306
|
};
|
|
15710
15307
|
|
|
15711
|
-
// Console functions
|
|
15712
|
-
|
|
15713
|
-
/* global alasql, yy */
|
|
15714
|
-
|
|
15715
15308
|
alasql.test = function (name, times, fn) {
|
|
15716
15309
|
if (arguments.length === 0) {
|
|
15717
15310
|
alasql.log(alasql.con.results);
|
|
@@ -19737,7 +19330,7 @@ if (typeof module !== 'undefined' && module.exports) {
|
|
|
19737
19330
|
|
|
19738
19331
|
//*only-for-browser/*
|
|
19739
19332
|
if(utils.isCordova || utils.isMeteorServer || utils.isNode ){
|
|
19740
|
-
console.
|
|
19333
|
+
console.log('It looks like you are using the browser version of AlaSQL. Please use the alasql.fs.js file instead.')
|
|
19741
19334
|
}
|
|
19742
19335
|
//*/
|
|
19743
19336
|
|