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.fs.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,19 @@ 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
|
+
})
|
|
3495
|
+
.catch((e) => {
|
|
3496
|
+
if (error) return error(e);
|
|
3497
|
+
console.error(e);
|
|
3498
|
+
throw e;
|
|
3499
|
+
});
|
|
3494
3500
|
} else {
|
|
3495
3501
|
//If async callthen call async
|
|
3496
3502
|
if (asy) {
|
|
@@ -3543,16 +3549,16 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3543
3549
|
if (typeof path === 'string') {
|
|
3544
3550
|
// For browser read from tag
|
|
3545
3551
|
/*
|
|
3546
|
-
|
|
3547
|
-
|
|
3552
|
+
SELECT * FROM TXT('#one') -- read data from HTML element with id="one"
|
|
3553
|
+
*/
|
|
3548
3554
|
if (path.substr(0, 1) === '#' && typeof document !== 'undefined') {
|
|
3549
3555
|
data = document.querySelector(path).textContent;
|
|
3550
3556
|
success(data);
|
|
3551
3557
|
} else {
|
|
3552
3558
|
/*
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3559
|
+
Simply read file from HTTP request, like:
|
|
3560
|
+
SELECT * FROM TXT('http://alasql.org/README.md');
|
|
3561
|
+
*/
|
|
3556
3562
|
var xhr = new XMLHttpRequest();
|
|
3557
3563
|
xhr.onreadystatechange = function () {
|
|
3558
3564
|
if (xhr.readyState === 4) {
|
|
@@ -3572,14 +3578,14 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3572
3578
|
}
|
|
3573
3579
|
} else if (path instanceof Event) {
|
|
3574
3580
|
/*
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3581
|
+
For browser read from files input element
|
|
3582
|
+
<input type="files" onchange="readFile(event)">
|
|
3583
|
+
<script>
|
|
3584
|
+
function readFile(event) {
|
|
3585
|
+
alasql('SELECT * FROM TXT(?)',[event])
|
|
3586
|
+
}
|
|
3587
|
+
</script>
|
|
3588
|
+
*/
|
|
3583
3589
|
/** @type {array} List of files from <input> element */
|
|
3584
3590
|
var files = path.target.files;
|
|
3585
3591
|
/** type {object} */
|
|
@@ -3596,15 +3602,15 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3596
3602
|
});
|
|
3597
3603
|
|
|
3598
3604
|
/**
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3605
|
+
@function Load binary file from anywhere
|
|
3606
|
+
@param {string} path File path
|
|
3607
|
+
@param {boolean} asy True - async call, false - sync call
|
|
3608
|
+
@param {function} success Success function
|
|
3609
|
+
@param {function} error Error function
|
|
3610
|
+
@return 1 for Async, data - for sync version
|
|
3611
|
+
|
|
3612
|
+
@todo merge functionality from loadFile and LoadBinaryFile
|
|
3613
|
+
*/
|
|
3608
3614
|
|
|
3609
3615
|
var loadBinaryFile = (utils.loadBinaryFile = function (
|
|
3610
3616
|
path,
|
|
@@ -3620,17 +3626,19 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
|
|
|
3620
3626
|
fs = require('fs');
|
|
3621
3627
|
|
|
3622
3628
|
if (/^[a-z]+:\/\//i.test(path)) {
|
|
3623
|
-
var
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3629
|
+
var fetch = require('node-fetch');
|
|
3630
|
+
fetch(path)
|
|
3631
|
+
.then((response) => response.arrayBuffer())
|
|
3632
|
+
.then((buf) => {
|
|
3633
|
+
var a = new Uint8Array(buf);
|
|
3634
|
+
var b = [...a].map((e) => String.fromCharCode(e)).join('');
|
|
3635
|
+
success(b);
|
|
3636
|
+
})
|
|
3637
|
+
.catch((e) => {
|
|
3638
|
+
if (error) return error(e);
|
|
3639
|
+
console.error(e);
|
|
3640
|
+
throw e;
|
|
3641
|
+
});
|
|
3634
3642
|
} else {
|
|
3635
3643
|
if (runAsync) {
|
|
3636
3644
|
fs.readFile(path, function (err, data) {
|
|
@@ -3807,12 +3815,12 @@ var fileExists = (utils.fileExists = function (path, cb) {
|
|
|
3807
3815
|
});
|
|
3808
3816
|
|
|
3809
3817
|
/**
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3818
|
+
Save text file from anywhere
|
|
3819
|
+
@param {string} path File path
|
|
3820
|
+
@param {array} data Data object
|
|
3821
|
+
@param {function} cb Callback
|
|
3822
|
+
@param {object=} opts
|
|
3823
|
+
*/
|
|
3816
3824
|
|
|
3817
3825
|
var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
3818
3826
|
var res = 1;
|
|
@@ -3895,21 +3903,21 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
|
3895
3903
|
});
|
|
3896
3904
|
|
|
3897
3905
|
/**
|
|
3898
|
-
|
|
3899
|
-
|
|
3906
|
+
@function Is this IE9
|
|
3907
|
+
@return {boolean} True for IE9 and false for other browsers
|
|
3900
3908
|
|
|
3901
|
-
|
|
3902
|
-
|
|
3909
|
+
For IE9 compatibility issues
|
|
3910
|
+
*/
|
|
3903
3911
|
function isIE() {
|
|
3904
3912
|
var myNav = navigator.userAgent.toLowerCase();
|
|
3905
3913
|
return myNav.indexOf('msie') !== -1 ? parseInt(myNav.split('msie')[1]) : false;
|
|
3906
3914
|
}
|
|
3907
3915
|
|
|
3908
3916
|
/**
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3917
|
+
@function Hash a string to signed integer
|
|
3918
|
+
@param {string} source string
|
|
3919
|
+
@return {integer} hash number
|
|
3920
|
+
*/
|
|
3913
3921
|
|
|
3914
3922
|
// FNV-1a inspired hashing
|
|
3915
3923
|
var hash = (utils.hash = function (str) {
|
|
@@ -3923,12 +3931,12 @@ var hash = (utils.hash = function (str) {
|
|
|
3923
3931
|
});
|
|
3924
3932
|
|
|
3925
3933
|
/**
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3934
|
+
Union arrays
|
|
3935
|
+
@function
|
|
3936
|
+
@param {array} a
|
|
3937
|
+
@param {array} b
|
|
3938
|
+
@return {array}
|
|
3939
|
+
*/
|
|
3932
3940
|
var arrayUnion = (utils.arrayUnion = function (a, b) {
|
|
3933
3941
|
var r = b.slice(0);
|
|
3934
3942
|
a.forEach(function (i) {
|
|
@@ -3940,8 +3948,8 @@ var arrayUnion = (utils.arrayUnion = function (a, b) {
|
|
|
3940
3948
|
});
|
|
3941
3949
|
|
|
3942
3950
|
/**
|
|
3943
|
-
|
|
3944
|
-
|
|
3951
|
+
Array Difference
|
|
3952
|
+
*/
|
|
3945
3953
|
var arrayDiff = (utils.arrayDiff = function (a, b) {
|
|
3946
3954
|
return a.filter(function (i) {
|
|
3947
3955
|
return b.indexOf(i) < 0;
|
|
@@ -3949,8 +3957,8 @@ var arrayDiff = (utils.arrayDiff = function (a, b) {
|
|
|
3949
3957
|
});
|
|
3950
3958
|
|
|
3951
3959
|
/**
|
|
3952
|
-
|
|
3953
|
-
|
|
3960
|
+
Arrays deep intersect (with records)
|
|
3961
|
+
*/
|
|
3954
3962
|
var arrayIntersect = (utils.arrayIntersect = function (a, b) {
|
|
3955
3963
|
var r = [];
|
|
3956
3964
|
a.forEach(function (ai) {
|
|
@@ -3968,8 +3976,8 @@ var arrayIntersect = (utils.arrayIntersect = function (a, b) {
|
|
|
3968
3976
|
});
|
|
3969
3977
|
|
|
3970
3978
|
/**
|
|
3971
|
-
|
|
3972
|
-
|
|
3979
|
+
Arrays deep union (with records)
|
|
3980
|
+
*/
|
|
3973
3981
|
var arrayUnionDeep = (utils.arrayUnionDeep = function (a, b) {
|
|
3974
3982
|
var r = b.slice(0);
|
|
3975
3983
|
a.forEach(function (ai) {
|
|
@@ -3988,8 +3996,8 @@ var arrayUnionDeep = (utils.arrayUnionDeep = function (a, b) {
|
|
|
3988
3996
|
});
|
|
3989
3997
|
|
|
3990
3998
|
/**
|
|
3991
|
-
|
|
3992
|
-
|
|
3999
|
+
Arrays deep union (with records)
|
|
4000
|
+
*/
|
|
3993
4001
|
var arrayExceptDeep = (utils.arrayExceptDeep = function (a, b) {
|
|
3994
4002
|
var r = [];
|
|
3995
4003
|
a.forEach(function (ai) {
|
|
@@ -4008,8 +4016,8 @@ var arrayExceptDeep = (utils.arrayExceptDeep = function (a, b) {
|
|
|
4008
4016
|
});
|
|
4009
4017
|
|
|
4010
4018
|
/**
|
|
4011
|
-
|
|
4012
|
-
|
|
4019
|
+
Arrays deep intersect (with records)
|
|
4020
|
+
*/
|
|
4013
4021
|
var arrayIntersectDeep = (utils.arrayIntersectDeep = function (a, b) {
|
|
4014
4022
|
var r = [];
|
|
4015
4023
|
a.forEach(function (ai) {
|
|
@@ -4028,8 +4036,8 @@ var arrayIntersectDeep = (utils.arrayIntersectDeep = function (a, b) {
|
|
|
4028
4036
|
});
|
|
4029
4037
|
|
|
4030
4038
|
/**
|
|
4031
|
-
|
|
4032
|
-
|
|
4039
|
+
Deep clone objects
|
|
4040
|
+
*/
|
|
4033
4041
|
var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
4034
4042
|
if (null === obj || typeof obj !== 'object') {
|
|
4035
4043
|
return obj;
|
|
@@ -4058,12 +4066,12 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4058
4066
|
});
|
|
4059
4067
|
|
|
4060
4068
|
/**
|
|
4061
|
-
|
|
4062
|
-
|
|
4069
|
+
Check equality of objects
|
|
4070
|
+
*/
|
|
4063
4071
|
|
|
4064
4072
|
/**
|
|
4065
|
-
|
|
4066
|
-
|
|
4073
|
+
Compare two objects in deep
|
|
4074
|
+
*/
|
|
4067
4075
|
var deepEqual = (utils.deepEqual = function (x, y) {
|
|
4068
4076
|
if (x === y) {
|
|
4069
4077
|
return true;
|
|
@@ -4084,10 +4092,10 @@ var deepEqual = (utils.deepEqual = function (x, y) {
|
|
|
4084
4092
|
return false;
|
|
4085
4093
|
});
|
|
4086
4094
|
/**
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4095
|
+
Array with distinct records
|
|
4096
|
+
@param {array} data
|
|
4097
|
+
@return {array}
|
|
4098
|
+
*/
|
|
4091
4099
|
var distinctArray = (utils.distinctArray = function (data) {
|
|
4092
4100
|
var uniq = {};
|
|
4093
4101
|
// TODO: Speedup, because Object.keys is slow
|
|
@@ -4113,12 +4121,12 @@ var distinctArray = (utils.distinctArray = function (data) {
|
|
|
4113
4121
|
});
|
|
4114
4122
|
|
|
4115
4123
|
/**
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4124
|
+
Extend object a with properties of b
|
|
4125
|
+
@function
|
|
4126
|
+
@param {object} a
|
|
4127
|
+
@param {object} b
|
|
4128
|
+
@return {object}
|
|
4129
|
+
*/
|
|
4122
4130
|
var extend = (utils.extend = function extend(a, b) {
|
|
4123
4131
|
a = a || {};
|
|
4124
4132
|
for (var key in b) {
|
|
@@ -4139,8 +4147,8 @@ var getValueOf = (utils.getValueOf = function (val) {
|
|
|
4139
4147
|
});
|
|
4140
4148
|
|
|
4141
4149
|
/**
|
|
4142
|
-
|
|
4143
|
-
|
|
4150
|
+
Flat array by first row
|
|
4151
|
+
*/
|
|
4144
4152
|
var flatArray = (utils.flatArray = function (a) {
|
|
4145
4153
|
|
|
4146
4154
|
if (!a || 0 === a.length) {
|
|
@@ -4164,8 +4172,8 @@ var flatArray = (utils.flatArray = function (a) {
|
|
|
4164
4172
|
});
|
|
4165
4173
|
|
|
4166
4174
|
/**
|
|
4167
|
-
|
|
4168
|
-
|
|
4175
|
+
Convert array of objects to array of arrays
|
|
4176
|
+
*/
|
|
4169
4177
|
var arrayOfArrays = (utils.arrayOfArrays = function (a) {
|
|
4170
4178
|
return a.map(function (aa) {
|
|
4171
4179
|
var ar = [];
|
|
@@ -4183,12 +4191,18 @@ if (!Array.isArray) {
|
|
|
4183
4191
|
}
|
|
4184
4192
|
|
|
4185
4193
|
/**
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4194
|
+
Excel:convert number to Excel column, like 1 => 'A'
|
|
4195
|
+
@param {integer} i Column number, starting with 0
|
|
4196
|
+
@return {string} Column name, starting with 'A'
|
|
4197
|
+
*/
|
|
4190
4198
|
|
|
4191
4199
|
var xlsnc = (utils.xlsnc = function (i) {
|
|
4200
|
+
var first = '';
|
|
4201
|
+
if (i > 701) {
|
|
4202
|
+
let x = (((i - 26) / (26 * 26)) | 0) - 1;
|
|
4203
|
+
first = String.fromCharCode(65 + (x % 26));
|
|
4204
|
+
i = i % (26 * 26);
|
|
4205
|
+
}
|
|
4192
4206
|
var addr = String.fromCharCode(65 + (i % 26));
|
|
4193
4207
|
if (i >= 26) {
|
|
4194
4208
|
i = ((i / 26) | 0) - 1;
|
|
@@ -4198,14 +4212,14 @@ var xlsnc = (utils.xlsnc = function (i) {
|
|
|
4198
4212
|
addr = String.fromCharCode(65 + (i % 26)) + addr;
|
|
4199
4213
|
}
|
|
4200
4214
|
}
|
|
4201
|
-
return addr;
|
|
4215
|
+
return first + addr;
|
|
4202
4216
|
});
|
|
4203
4217
|
|
|
4204
4218
|
/**
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4219
|
+
Excel:conver Excel column name to number
|
|
4220
|
+
@param {string} s Column number, like 'A' or 'BE'
|
|
4221
|
+
@return {string} Column name, starting with 0
|
|
4222
|
+
*/
|
|
4209
4223
|
var xlscn = (utils.xlscn = function (s) {
|
|
4210
4224
|
var n = s.charCodeAt(0) - 65;
|
|
4211
4225
|
if (s.length > 1) {
|
|
@@ -4226,12 +4240,12 @@ var domEmptyChildren = (utils.domEmptyChildren = function (container) {
|
|
|
4226
4240
|
});
|
|
4227
4241
|
|
|
4228
4242
|
/**
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4243
|
+
SQL LIKE emulation
|
|
4244
|
+
@parameter {string} pattern Search pattern
|
|
4245
|
+
@parameter {string} value Searched value
|
|
4246
|
+
@parameter {string} escape Escape character (optional)
|
|
4247
|
+
@return {boolean} If value LIKE pattern ESCAPE escape
|
|
4248
|
+
*/
|
|
4235
4249
|
|
|
4236
4250
|
var like = (utils.like = function (pattern, value, escape) {
|
|
4237
4251
|
// Verify escape character
|
|
@@ -4302,9 +4316,9 @@ utils.glob = function (value, pattern) {
|
|
|
4302
4316
|
};
|
|
4303
4317
|
|
|
4304
4318
|
/**
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4319
|
+
Get path of alasql.js
|
|
4320
|
+
@todo Rewrite and simplify the code. Review, is this function is required separately
|
|
4321
|
+
*/
|
|
4308
4322
|
utils.findAlaSQLPath = function () {
|
|
4309
4323
|
/** type {string} Path to alasql library and plugins */
|
|
4310
4324
|
|
|
@@ -4848,422 +4862,7 @@ alasql.compile = function (sql, databaseid) {
|
|
|
4848
4862
|
//
|
|
4849
4863
|
|
|
4850
4864
|
if (!utils.global.Promise) {
|
|
4851
|
-
|
|
4852
|
-
//*not-for-browser/*
|
|
4853
|
-
utils.global.Promise = require('es6-promise').Promise;
|
|
4854
|
-
//*/
|
|
4855
|
-
} else {
|
|
4856
|
-
/*!
|
|
4857
|
-
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
4858
|
-
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
4859
|
-
* @license Licensed under MIT license
|
|
4860
|
-
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
|
|
4861
|
-
* @version 3.2.1
|
|
4862
|
-
*/
|
|
4863
|
-
(function () {
|
|
4864
|
-
'use strict';
|
|
4865
|
-
function t(t) {
|
|
4866
|
-
return 'function' == typeof t || ('object' == typeof t && null !== t);
|
|
4867
|
-
}
|
|
4868
|
-
function e(t) {
|
|
4869
|
-
return 'function' == typeof t;
|
|
4870
|
-
}
|
|
4871
|
-
function n(t) {
|
|
4872
|
-
G = t;
|
|
4873
|
-
}
|
|
4874
|
-
function r(t) {
|
|
4875
|
-
Q = t;
|
|
4876
|
-
}
|
|
4877
|
-
function o() {
|
|
4878
|
-
return function () {
|
|
4879
|
-
process.nextTick(a);
|
|
4880
|
-
};
|
|
4881
|
-
}
|
|
4882
|
-
function i() {
|
|
4883
|
-
return function () {
|
|
4884
|
-
B(a);
|
|
4885
|
-
};
|
|
4886
|
-
}
|
|
4887
|
-
function s() {
|
|
4888
|
-
var t = 0,
|
|
4889
|
-
e = new X(a),
|
|
4890
|
-
n = document.createTextNode('');
|
|
4891
|
-
return (
|
|
4892
|
-
e.observe(n, {characterData: !0}),
|
|
4893
|
-
function () {
|
|
4894
|
-
n.data = t = ++t % 2;
|
|
4895
|
-
}
|
|
4896
|
-
);
|
|
4897
|
-
}
|
|
4898
|
-
function u() {
|
|
4899
|
-
var t = new MessageChannel();
|
|
4900
|
-
return (
|
|
4901
|
-
(t.port1.onmessage = a),
|
|
4902
|
-
function () {
|
|
4903
|
-
t.port2.postMessage(0);
|
|
4904
|
-
}
|
|
4905
|
-
);
|
|
4906
|
-
}
|
|
4907
|
-
function c() {
|
|
4908
|
-
return function () {
|
|
4909
|
-
setTimeout(a, 1);
|
|
4910
|
-
};
|
|
4911
|
-
}
|
|
4912
|
-
function a() {
|
|
4913
|
-
for (var t = 0; J > t; t += 2) {
|
|
4914
|
-
var e = tt[t],
|
|
4915
|
-
n = tt[t + 1];
|
|
4916
|
-
e(n), (tt[t] = void 0), (tt[t + 1] = void 0);
|
|
4917
|
-
}
|
|
4918
|
-
J = 0;
|
|
4919
|
-
}
|
|
4920
|
-
function f() {
|
|
4921
|
-
try {
|
|
4922
|
-
var t = require,
|
|
4923
|
-
e = t('vertx');
|
|
4924
|
-
return (B = e.runOnLoop || e.runOnContext), i();
|
|
4925
|
-
} catch (n) {
|
|
4926
|
-
return c();
|
|
4927
|
-
}
|
|
4928
|
-
}
|
|
4929
|
-
function l(t, e) {
|
|
4930
|
-
var n = this,
|
|
4931
|
-
r = new this.constructor(p);
|
|
4932
|
-
void 0 === r[rt] && k(r);
|
|
4933
|
-
var o = n._state;
|
|
4934
|
-
if (o) {
|
|
4935
|
-
var i = arguments[o - 1];
|
|
4936
|
-
Q(function () {
|
|
4937
|
-
x(o, r, i, n._result);
|
|
4938
|
-
});
|
|
4939
|
-
} else E(n, r, t, e);
|
|
4940
|
-
return r;
|
|
4941
|
-
}
|
|
4942
|
-
function h(t) {
|
|
4943
|
-
var e = this;
|
|
4944
|
-
if (t && 'object' == typeof t && t.constructor === e) return t;
|
|
4945
|
-
var n = new e(p);
|
|
4946
|
-
return g(n, t), n;
|
|
4947
|
-
}
|
|
4948
|
-
function p() {}
|
|
4949
|
-
function _() {
|
|
4950
|
-
return new TypeError('You cannot resolve a promise with itself');
|
|
4951
|
-
}
|
|
4952
|
-
function d() {
|
|
4953
|
-
return new TypeError('A promises callback cannot return that same promise.');
|
|
4954
|
-
}
|
|
4955
|
-
function v(t) {
|
|
4956
|
-
try {
|
|
4957
|
-
return t.then;
|
|
4958
|
-
} catch (e) {
|
|
4959
|
-
return (ut.error = e), ut;
|
|
4960
|
-
}
|
|
4961
|
-
}
|
|
4962
|
-
function y(t, e, n, r) {
|
|
4963
|
-
try {
|
|
4964
|
-
t.call(e, n, r);
|
|
4965
|
-
} catch (o) {
|
|
4966
|
-
return o;
|
|
4967
|
-
}
|
|
4968
|
-
}
|
|
4969
|
-
function m(t, e, n) {
|
|
4970
|
-
Q(function (t) {
|
|
4971
|
-
var r = !1,
|
|
4972
|
-
o = y(
|
|
4973
|
-
n,
|
|
4974
|
-
e,
|
|
4975
|
-
function (n) {
|
|
4976
|
-
r || ((r = !0), e !== n ? g(t, n) : S(t, n));
|
|
4977
|
-
},
|
|
4978
|
-
function (e) {
|
|
4979
|
-
r || ((r = !0), j(t, e));
|
|
4980
|
-
},
|
|
4981
|
-
'Settle: ' + (t._label || ' unknown promise')
|
|
4982
|
-
);
|
|
4983
|
-
!r && o && ((r = !0), j(t, o));
|
|
4984
|
-
}, t);
|
|
4985
|
-
}
|
|
4986
|
-
function b(t, e) {
|
|
4987
|
-
e._state === it
|
|
4988
|
-
? S(t, e._result)
|
|
4989
|
-
: e._state === st
|
|
4990
|
-
? j(t, e._result)
|
|
4991
|
-
: E(
|
|
4992
|
-
e,
|
|
4993
|
-
void 0,
|
|
4994
|
-
function (e) {
|
|
4995
|
-
g(t, e);
|
|
4996
|
-
},
|
|
4997
|
-
function (e) {
|
|
4998
|
-
j(t, e);
|
|
4999
|
-
}
|
|
5000
|
-
);
|
|
5001
|
-
}
|
|
5002
|
-
function w(t, n, r) {
|
|
5003
|
-
n.constructor === t.constructor && r === et && constructor.resolve === nt
|
|
5004
|
-
? b(t, n)
|
|
5005
|
-
: r === ut
|
|
5006
|
-
? j(t, ut.error)
|
|
5007
|
-
: void 0 === r
|
|
5008
|
-
? S(t, n)
|
|
5009
|
-
: e(r)
|
|
5010
|
-
? m(t, n, r)
|
|
5011
|
-
: S(t, n);
|
|
5012
|
-
}
|
|
5013
|
-
function g(e, n) {
|
|
5014
|
-
e === n ? j(e, _()) : t(n) ? w(e, n, v(n)) : S(e, n);
|
|
5015
|
-
}
|
|
5016
|
-
function A(t) {
|
|
5017
|
-
t._onerror && t._onerror(t._result), T(t);
|
|
5018
|
-
}
|
|
5019
|
-
function S(t, e) {
|
|
5020
|
-
t._state === ot &&
|
|
5021
|
-
((t._result = e), (t._state = it), 0 !== t._subscribers.length && Q(T, t));
|
|
5022
|
-
}
|
|
5023
|
-
function j(t, e) {
|
|
5024
|
-
t._state === ot && ((t._state = st), (t._result = e), Q(A, t));
|
|
5025
|
-
}
|
|
5026
|
-
function E(t, e, n, r) {
|
|
5027
|
-
var o = t._subscribers,
|
|
5028
|
-
i = o.length;
|
|
5029
|
-
(t._onerror = null),
|
|
5030
|
-
(o[i] = e),
|
|
5031
|
-
(o[i + it] = n),
|
|
5032
|
-
(o[i + st] = r),
|
|
5033
|
-
0 === i && t._state && Q(T, t);
|
|
5034
|
-
}
|
|
5035
|
-
function T(t) {
|
|
5036
|
-
var e = t._subscribers,
|
|
5037
|
-
n = t._state;
|
|
5038
|
-
if (0 !== e.length) {
|
|
5039
|
-
for (var r, o, i = t._result, s = 0; s < e.length; s += 3)
|
|
5040
|
-
(r = e[s]), (o = e[s + n]), r ? x(n, r, o, i) : o(i);
|
|
5041
|
-
t._subscribers.length = 0;
|
|
5042
|
-
}
|
|
5043
|
-
}
|
|
5044
|
-
function M() {
|
|
5045
|
-
this.error = null;
|
|
5046
|
-
}
|
|
5047
|
-
function P(t, e) {
|
|
5048
|
-
try {
|
|
5049
|
-
return t(e);
|
|
5050
|
-
} catch (n) {
|
|
5051
|
-
return (ct.error = n), ct;
|
|
5052
|
-
}
|
|
5053
|
-
}
|
|
5054
|
-
function x(t, n, r, o) {
|
|
5055
|
-
var i,
|
|
5056
|
-
s,
|
|
5057
|
-
u,
|
|
5058
|
-
c,
|
|
5059
|
-
a = e(r);
|
|
5060
|
-
if (a) {
|
|
5061
|
-
if (((i = P(r, o)), i === ct ? ((c = !0), (s = i.error), (i = null)) : (u = !0), n === i))
|
|
5062
|
-
return void j(n, d());
|
|
5063
|
-
} else (i = o), (u = !0);
|
|
5064
|
-
n._state !== ot ||
|
|
5065
|
-
(a && u ? g(n, i) : c ? j(n, s) : t === it ? S(n, i) : t === st && j(n, i));
|
|
5066
|
-
}
|
|
5067
|
-
function C(t, e) {
|
|
5068
|
-
try {
|
|
5069
|
-
e(
|
|
5070
|
-
function (e) {
|
|
5071
|
-
g(t, e);
|
|
5072
|
-
},
|
|
5073
|
-
function (e) {
|
|
5074
|
-
j(t, e);
|
|
5075
|
-
}
|
|
5076
|
-
);
|
|
5077
|
-
} catch (n) {
|
|
5078
|
-
j(t, n);
|
|
5079
|
-
}
|
|
5080
|
-
}
|
|
5081
|
-
function O() {
|
|
5082
|
-
return at++;
|
|
5083
|
-
}
|
|
5084
|
-
function k(t) {
|
|
5085
|
-
(t[rt] = at++), (t._state = void 0), (t._result = void 0), (t._subscribers = []);
|
|
5086
|
-
}
|
|
5087
|
-
function Y(t) {
|
|
5088
|
-
return new _t(this, t).promise;
|
|
5089
|
-
}
|
|
5090
|
-
function q(t) {
|
|
5091
|
-
var e = this;
|
|
5092
|
-
return new e(
|
|
5093
|
-
I(t)
|
|
5094
|
-
? function (n, r) {
|
|
5095
|
-
for (var o = t.length, i = 0; o > i; i++) e.resolve(t[i]).then(n, r);
|
|
5096
|
-
}
|
|
5097
|
-
: function (t, e) {
|
|
5098
|
-
e(new TypeError('You must pass an array to race.'));
|
|
5099
|
-
}
|
|
5100
|
-
);
|
|
5101
|
-
}
|
|
5102
|
-
function F(t) {
|
|
5103
|
-
var e = this,
|
|
5104
|
-
n = new e(p);
|
|
5105
|
-
return j(n, t), n;
|
|
5106
|
-
}
|
|
5107
|
-
function D() {
|
|
5108
|
-
throw new TypeError(
|
|
5109
|
-
'You must pass a resolver function as the first argument to the promise constructor'
|
|
5110
|
-
);
|
|
5111
|
-
}
|
|
5112
|
-
function K() {
|
|
5113
|
-
throw new TypeError(
|
|
5114
|
-
"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."
|
|
5115
|
-
);
|
|
5116
|
-
}
|
|
5117
|
-
function L(t) {
|
|
5118
|
-
(this[rt] = O()),
|
|
5119
|
-
(this._result = this._state = void 0),
|
|
5120
|
-
(this._subscribers = []),
|
|
5121
|
-
p !== t && ('function' != typeof t && D(), this instanceof L ? C(this, t) : K());
|
|
5122
|
-
}
|
|
5123
|
-
function N(t, e) {
|
|
5124
|
-
(this._instanceConstructor = t),
|
|
5125
|
-
(this.promise = new t(p)),
|
|
5126
|
-
this.promise[rt] || k(this.promise),
|
|
5127
|
-
Array.isArray(e)
|
|
5128
|
-
? ((this._input = e),
|
|
5129
|
-
(this.length = e.length),
|
|
5130
|
-
(this._remaining = e.length),
|
|
5131
|
-
(this._result = new Array(this.length)),
|
|
5132
|
-
0 === this.length
|
|
5133
|
-
? S(this.promise, this._result)
|
|
5134
|
-
: ((this.length = this.length || 0),
|
|
5135
|
-
this._enumerate(),
|
|
5136
|
-
0 === this._remaining && S(this.promise, this._result)))
|
|
5137
|
-
: j(this.promise, U());
|
|
5138
|
-
}
|
|
5139
|
-
function U() {
|
|
5140
|
-
return new Error('Array Methods must be provided an Array');
|
|
5141
|
-
}
|
|
5142
|
-
function W() {
|
|
5143
|
-
var t;
|
|
5144
|
-
if ('undefined' != typeof global) t = global;
|
|
5145
|
-
else if ('undefined' != typeof self) t = self;
|
|
5146
|
-
else
|
|
5147
|
-
try {
|
|
5148
|
-
t = Function('return this')();
|
|
5149
|
-
} catch (e) {
|
|
5150
|
-
throw new Error(
|
|
5151
|
-
'polyfill failed because global object is unavailable in this environment'
|
|
5152
|
-
);
|
|
5153
|
-
}
|
|
5154
|
-
var n = t.Promise;
|
|
5155
|
-
(!n || '[object Promise]' !== Object.prototype.toString.call(n.resolve()) || n.cast) &&
|
|
5156
|
-
(t.Promise = pt);
|
|
5157
|
-
}
|
|
5158
|
-
var z;
|
|
5159
|
-
z = Array.isArray
|
|
5160
|
-
? Array.isArray
|
|
5161
|
-
: function (t) {
|
|
5162
|
-
return '[object Array]' === Object.prototype.toString.call(t);
|
|
5163
|
-
};
|
|
5164
|
-
var B,
|
|
5165
|
-
G,
|
|
5166
|
-
H,
|
|
5167
|
-
I = z,
|
|
5168
|
-
J = 0,
|
|
5169
|
-
Q = function (t, e) {
|
|
5170
|
-
(tt[J] = t), (tt[J + 1] = e), (J += 2), 2 === J && (G ? G(a) : H());
|
|
5171
|
-
},
|
|
5172
|
-
R = 'undefined' != typeof window ? window : void 0,
|
|
5173
|
-
V = R || {},
|
|
5174
|
-
X = V.MutationObserver || V.WebKitMutationObserver,
|
|
5175
|
-
Z =
|
|
5176
|
-
'undefined' == typeof self &&
|
|
5177
|
-
'undefined' != typeof process &&
|
|
5178
|
-
'[object process]' === {}.toString.call(process),
|
|
5179
|
-
$ =
|
|
5180
|
-
'undefined' != typeof Uint8ClampedArray &&
|
|
5181
|
-
'undefined' != typeof importScripts &&
|
|
5182
|
-
'undefined' != typeof MessageChannel,
|
|
5183
|
-
tt = new Array(1e3);
|
|
5184
|
-
H = Z ? o() : X ? s() : $ ? u() : void 0 === R && 'function' == typeof require ? f() : c();
|
|
5185
|
-
var et = l,
|
|
5186
|
-
nt = h,
|
|
5187
|
-
rt = Math.random().toString(36).substring(16),
|
|
5188
|
-
ot = void 0,
|
|
5189
|
-
it = 1,
|
|
5190
|
-
st = 2,
|
|
5191
|
-
ut = new M(),
|
|
5192
|
-
ct = new M(),
|
|
5193
|
-
at = 0,
|
|
5194
|
-
ft = Y,
|
|
5195
|
-
lt = q,
|
|
5196
|
-
ht = F,
|
|
5197
|
-
pt = L;
|
|
5198
|
-
(L.all = ft),
|
|
5199
|
-
(L.race = lt),
|
|
5200
|
-
(L.resolve = nt),
|
|
5201
|
-
(L.reject = ht),
|
|
5202
|
-
(L._setScheduler = n),
|
|
5203
|
-
(L._setAsap = r),
|
|
5204
|
-
(L._asap = Q),
|
|
5205
|
-
(L.prototype = {
|
|
5206
|
-
constructor: L,
|
|
5207
|
-
then: et,
|
|
5208
|
-
catch: function (t) {
|
|
5209
|
-
return this.then(null, t);
|
|
5210
|
-
},
|
|
5211
|
-
});
|
|
5212
|
-
var _t = N;
|
|
5213
|
-
(N.prototype._enumerate = function () {
|
|
5214
|
-
for (var t = this.length, e = this._input, n = 0; this._state === ot && t > n; n++)
|
|
5215
|
-
this._eachEntry(e[n], n);
|
|
5216
|
-
}),
|
|
5217
|
-
(N.prototype._eachEntry = function (t, e) {
|
|
5218
|
-
var n = this._instanceConstructor,
|
|
5219
|
-
r = n.resolve;
|
|
5220
|
-
if (r === nt) {
|
|
5221
|
-
var o = v(t);
|
|
5222
|
-
if (o === et && t._state !== ot) this._settledAt(t._state, e, t._result);
|
|
5223
|
-
else if ('function' != typeof o) this._remaining--, (this._result[e] = t);
|
|
5224
|
-
else if (n === pt) {
|
|
5225
|
-
var i = new n(p);
|
|
5226
|
-
w(i, t, o), this._willSettleAt(i, e);
|
|
5227
|
-
} else
|
|
5228
|
-
this._willSettleAt(
|
|
5229
|
-
new n(function (e) {
|
|
5230
|
-
e(t);
|
|
5231
|
-
}),
|
|
5232
|
-
e
|
|
5233
|
-
);
|
|
5234
|
-
} else this._willSettleAt(r(t), e);
|
|
5235
|
-
}),
|
|
5236
|
-
(N.prototype._settledAt = function (t, e, n) {
|
|
5237
|
-
var r = this.promise;
|
|
5238
|
-
r._state === ot && (this._remaining--, t === st ? j(r, n) : (this._result[e] = n)),
|
|
5239
|
-
0 === this._remaining && S(r, this._result);
|
|
5240
|
-
}),
|
|
5241
|
-
(N.prototype._willSettleAt = function (t, e) {
|
|
5242
|
-
var n = this;
|
|
5243
|
-
E(
|
|
5244
|
-
t,
|
|
5245
|
-
void 0,
|
|
5246
|
-
function (t) {
|
|
5247
|
-
n._settledAt(it, e, t);
|
|
5248
|
-
},
|
|
5249
|
-
function (t) {
|
|
5250
|
-
n._settledAt(st, e, t);
|
|
5251
|
-
}
|
|
5252
|
-
);
|
|
5253
|
-
});
|
|
5254
|
-
var dt = W,
|
|
5255
|
-
vt = {Promise: pt, polyfill: dt};
|
|
5256
|
-
'function' == typeof define && define.amd
|
|
5257
|
-
? define(function () {
|
|
5258
|
-
return vt;
|
|
5259
|
-
})
|
|
5260
|
-
: 'undefined' != typeof module && module.exports
|
|
5261
|
-
? (module.exports = vt)
|
|
5262
|
-
: 'undefined' != typeof this && (this.ES6Promise = vt),
|
|
5263
|
-
dt();
|
|
5264
|
-
}.call(this));
|
|
5265
|
-
|
|
5266
|
-
}
|
|
4865
|
+
utils.global.Promise = Promise;
|
|
5267
4866
|
}
|
|
5268
4867
|
|
|
5269
4868
|
var promiseExec = function (sql, params, counterStep, counterTotal) {
|
|
@@ -15714,10 +15313,6 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
15714
15313
|
return res;
|
|
15715
15314
|
};
|
|
15716
15315
|
|
|
15717
|
-
// Console functions
|
|
15718
|
-
|
|
15719
|
-
/* global alasql, yy */
|
|
15720
|
-
|
|
15721
15316
|
alasql.test = function (name, times, fn) {
|
|
15722
15317
|
if (arguments.length === 0) {
|
|
15723
15318
|
alasql.log(alasql.con.results);
|
|
@@ -19743,7 +19338,7 @@ if (typeof module !== 'undefined' && module.exports) {
|
|
|
19743
19338
|
|
|
19744
19339
|
/*only-for-browser/*
|
|
19745
19340
|
if(utils.isCordova || utils.isMeteorServer || utils.isNode ){
|
|
19746
|
-
console.
|
|
19341
|
+
console.log('It looks like you are using the browser version of AlaSQL. Please use the alasql.fs.js file instead.')
|
|
19747
19342
|
}
|
|
19748
19343
|
//*/
|
|
19749
19344
|
|