Comparing version 10.117.1 to 10.118.0
@@ -222,2 +222,9 @@ (function() { | ||
this.DBay_unknown_variable = class DBay_unknown_variable extends this.DBay_error { | ||
constructor(ref, name) { | ||
super(ref, `unknown variable ${rpr(name)}`); | ||
} | ||
}; | ||
/* TAINT replace with more specific error, like below */ | ||
@@ -224,0 +231,0 @@ this.DBay_format_unknown = class DBay_format_unknown extends this.DBay_error { |
(function() { | ||
'use strict'; | ||
var CND, badge, debug, echo, freeze, help, info, lets, rpr, urge, walk_split_parts, warn, whisper; | ||
var CND, E, badge, debug, echo, freeze, help, info, lets, rpr, urge, walk_split_parts, warn, whisper; | ||
@@ -28,2 +28,4 @@ //########################################################################################################### | ||
E = require('./errors'); | ||
//----------------------------------------------------------------------------------------------------------- | ||
@@ -66,3 +68,3 @@ walk_split_parts = function*(text, splitter, omit_empty) { | ||
create_stdlib() { | ||
var prefix; | ||
var prefix, self; | ||
if (this._stdlib_created) { | ||
@@ -178,6 +180,53 @@ return null; | ||
}); | ||
//======================================================================================================= | ||
// VARIABLES | ||
//------------------------------------------------------------------------------------------------------- | ||
this.variables = {}; | ||
self = this; | ||
//------------------------------------------------------------------------------------------------------- | ||
this.create_function({ | ||
name: prefix + 'getv', | ||
deterministic: false, | ||
call: this.getv.bind(this) | ||
}); | ||
//------------------------------------------------------------------------------------------------------- | ||
this.create_table_function({ | ||
name: prefix + 'variables', | ||
deterministic: false, | ||
columns: ['name', 'value'], | ||
parameters: [], | ||
rows: (function*(name) { | ||
var results; | ||
results = []; | ||
for (name in this.variables) { | ||
results.push((yield [name, this.getv(name)])); | ||
} | ||
return results; | ||
}).bind(this) | ||
}); | ||
//------------------------------------------------------------------------------------------------------- | ||
return null; | ||
} | ||
//--------------------------------------------------------------------------------------------------------- | ||
setv(name, value) { | ||
return this.variables[name] = value; | ||
} | ||
//--------------------------------------------------------------------------------------------------------- | ||
getv(name) { | ||
var R; | ||
if ((R = this.variables[name]) === void 0) { | ||
throw new E.DBay_unknown_variable('^dbay/stdlib@1^', name); | ||
} | ||
switch (false) { | ||
case R !== true: | ||
return 1; | ||
case R !== false: | ||
return 0; | ||
default: | ||
return R; | ||
} | ||
} | ||
}; | ||
@@ -184,0 +233,0 @@ }; |
{ | ||
"name": "dbay", | ||
"version": "10.117.1", | ||
"version": "10.118.0", | ||
"description": "In-Process, In-Memory & File-Based Relational Data Processing with SQLite, BetterSQLite3", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11994483
1774