Update bot

Took 2 hours 17 minutes
This commit is contained in:
2021-03-15 09:32:14 +01:00
parent e76ad758b8
commit 6102599e5d
201 changed files with 26670 additions and 87 deletions

3
node_modules/generate-function/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,3 @@
language: node_js
node_js:
- "0.10"

21
node_modules/generate-function/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Mathias Buus
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

89
node_modules/generate-function/README.md generated vendored Normal file
View File

@ -0,0 +1,89 @@
# generate-function
Module that helps you write generated functions in Node
```
npm install generate-function
```
[![build status](http://img.shields.io/travis/mafintosh/generate-function.svg?style=flat)](http://travis-ci.org/mafintosh/generate-function)
## Disclamer
Writing code that generates code is hard.
You should only use this if you really, really, really need this for performance reasons (like schema validators / parsers etc).
## Usage
``` js
const genfun = require('generate-function')
const { d } = genfun.formats
function addNumber (val) {
const gen = genfun()
gen(`
function add (n) {')
return n + ${d(val)}) // supports format strings to insert values
}
`)
return gen.toFunction() // will compile the function
}
const add2 = addNumber(2)
console.log('1 + 2 =', add2(1))
console.log(add2.toString()) // prints the generated function
```
If you need to close over variables in your generated function pass them to `toFunction(scope)`
``` js
function multiply (a, b) {
return a * b
}
function addAndMultiplyNumber (val) {
const gen = genfun()
gen(`
function (n) {
if (typeof n !== 'number') {
throw new Error('argument should be a number')
}
const result = multiply(${d(val)}, n + ${d(val)})
return result
}
`)
// use gen.toString() if you want to see the generated source
return gen.toFunction({multiply})
}
const addAndMultiply2 = addAndMultiplyNumber(2)
console.log(addAndMultiply2.toString())
console.log('(3 + 2) * 2 =', addAndMultiply2(3))
```
You can call `gen(src)` as many times as you want to append more source code to the function.
## Variables
If you need a unique safe identifier for the scope of the generated function call `str = gen.sym('friendlyName')`.
These are safe to use for variable names etc.
## Object properties
If you need to access an object property use the `str = gen.property('objectName', 'propertyName')`.
This returns `'objectName.propertyName'` if `propertyName` is safe to use as a variable. Otherwise
it returns `objectName[propertyNameAsString]`.
If you only pass `gen.property('propertyName')` it will only return the `propertyName` part safely
## License
MIT

27
node_modules/generate-function/example.js generated vendored Normal file
View File

@ -0,0 +1,27 @@
const genfun = require('./')
const { d } = genfun.formats
function multiply (a, b) {
return a * b
}
function addAndMultiplyNumber (val) {
const fn = genfun(`
function (n) {
if (typeof n !== 'number') {
throw new Error('argument should be a number')
}
const result = multiply(${d(val)}, n + ${d(val)})
return result
}
`)
// use fn.toString() if you want to see the generated source
return fn.toFunction({multiply})
}
const addAndMultiply2 = addAndMultiplyNumber(2)
console.log(addAndMultiply2.toString())
console.log('(3 + 2) * 2 =', addAndMultiply2(3))

181
node_modules/generate-function/index.js generated vendored Normal file
View File

@ -0,0 +1,181 @@
var util = require('util')
var isProperty = require('is-property')
var INDENT_START = /[\{\[]/
var INDENT_END = /[\}\]]/
// from https://mathiasbynens.be/notes/reserved-keywords
var RESERVED = [
'do',
'if',
'in',
'for',
'let',
'new',
'try',
'var',
'case',
'else',
'enum',
'eval',
'null',
'this',
'true',
'void',
'with',
'await',
'break',
'catch',
'class',
'const',
'false',
'super',
'throw',
'while',
'yield',
'delete',
'export',
'import',
'public',
'return',
'static',
'switch',
'typeof',
'default',
'extends',
'finally',
'package',
'private',
'continue',
'debugger',
'function',
'arguments',
'interface',
'protected',
'implements',
'instanceof',
'NaN',
'undefined'
]
var RESERVED_MAP = {}
for (var i = 0; i < RESERVED.length; i++) {
RESERVED_MAP[RESERVED[i]] = true
}
var isVariable = function (name) {
return isProperty(name) && !RESERVED_MAP.hasOwnProperty(name)
}
var formats = {
s: function(s) {
return '' + s
},
d: function(d) {
return '' + Number(d)
},
o: function(o) {
return JSON.stringify(o)
}
}
var genfun = function() {
var lines = []
var indent = 0
var vars = {}
var push = function(str) {
var spaces = ''
while (spaces.length < indent*2) spaces += ' '
lines.push(spaces+str)
}
var pushLine = function(line) {
if (INDENT_END.test(line.trim()[0]) && INDENT_START.test(line[line.length-1])) {
indent--
push(line)
indent++
return
}
if (INDENT_START.test(line[line.length-1])) {
push(line)
indent++
return
}
if (INDENT_END.test(line.trim()[0])) {
indent--
push(line)
return
}
push(line)
}
var line = function(fmt) {
if (!fmt) return line
if (arguments.length === 1 && fmt.indexOf('\n') > -1) {
var lines = fmt.trim().split('\n')
for (var i = 0; i < lines.length; i++) {
pushLine(lines[i].trim())
}
} else {
pushLine(util.format.apply(util, arguments))
}
return line
}
line.scope = {}
line.formats = formats
line.sym = function(name) {
if (!name || !isVariable(name)) name = 'tmp'
if (!vars[name]) vars[name] = 0
return name + (vars[name]++ || '')
}
line.property = function(obj, name) {
if (arguments.length === 1) {
name = obj
obj = ''
}
name = name + ''
if (isProperty(name)) return (obj ? obj + '.' + name : name)
return obj ? obj + '[' + JSON.stringify(name) + ']' : JSON.stringify(name)
}
line.toString = function() {
return lines.join('\n')
}
line.toFunction = function(scope) {
if (!scope) scope = {}
var src = 'return ('+line.toString()+')'
Object.keys(line.scope).forEach(function (key) {
if (!scope[key]) scope[key] = line.scope[key]
})
var keys = Object.keys(scope).map(function(key) {
return key
})
var vals = keys.map(function(key) {
return scope[key]
})
return Function.apply(null, keys.concat(src)).apply(null, vals)
}
if (arguments.length) line.apply(null, arguments)
return line
}
genfun.formats = formats
module.exports = genfun

59
node_modules/generate-function/package.json generated vendored Normal file
View File

@ -0,0 +1,59 @@
{
"_from": "generate-function@^2.3.1",
"_id": "generate-function@2.3.1",
"_inBundle": false,
"_integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
"_location": "/generate-function",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "generate-function@^2.3.1",
"name": "generate-function",
"escapedName": "generate-function",
"rawSpec": "^2.3.1",
"saveSpec": null,
"fetchSpec": "^2.3.1"
},
"_requiredBy": [
"/mysql2"
],
"_resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
"_shasum": "f069617690c10c868e73b8465746764f97c3479f",
"_spec": "generate-function@^2.3.1",
"_where": "/home/tobias/IdeaProjects/Woam-Antispam-Bot/node_modules/mysql2",
"author": {
"name": "Mathias Buus"
},
"bugs": {
"url": "https://github.com/mafintosh/generate-function/issues"
},
"bundleDependencies": false,
"dependencies": {
"is-property": "^1.0.2"
},
"deprecated": false,
"description": "Module that helps you write generated functions in Node",
"devDependencies": {
"tape": "^4.9.1"
},
"homepage": "https://github.com/mafintosh/generate-function",
"keywords": [
"generate",
"code",
"generation",
"function",
"performance"
],
"license": "MIT",
"main": "index.js",
"name": "generate-function",
"repository": {
"type": "git",
"url": "git+https://github.com/mafintosh/generate-function.git"
},
"scripts": {
"test": "tape test.js"
},
"version": "2.3.1"
}

49
node_modules/generate-function/test.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
var tape = require('tape')
var genfun = require('./')
tape('generate add function', function(t) {
var fn = genfun()
('function add(n) {')
('return n + %d', 42)
('}')
t.same(fn.toString(), 'function add(n) {\n return n + 42\n}', 'code is indented')
t.same(fn.toFunction()(10), 52, 'function works')
t.end()
})
tape('generate function + closed variables', function(t) {
var fn = genfun()
('function add(n) {')
('return n + %d + number', 42)
('}')
var notGood = fn.toFunction()
var good = fn.toFunction({number:10})
try {
notGood(10)
t.ok(false, 'function should not work')
} catch (err) {
t.same(err.message, 'number is not defined', 'throws reference error')
}
t.same(good(11), 63, 'function with closed var works')
t.end()
})
tape('generate property', function(t) {
var gen = genfun()
t.same(gen.property('a'), 'a')
t.same(gen.property('42'), '"42"')
t.same(gen.property('b', 'a'), 'b.a')
t.same(gen.property('b', '42'), 'b["42"]')
t.same(gen.sym(42), 'tmp')
t.same(gen.sym('a'), 'a')
t.same(gen.sym('a'), 'a1')
t.same(gen.sym(42), 'tmp1')
t.same(gen.sym('const'), 'tmp2')
t.end()
})