mirror of
https://github.com/JonasunderscoreJones/jonas_jones-api.git
synced 2025-10-23 09:09:18 +02:00
some progress
This commit is contained in:
parent
aea93a5527
commit
e3c15bd288
1388 changed files with 306946 additions and 68323 deletions
202
node_modules/kareem/LICENSE
generated
vendored
Normal file
202
node_modules/kareem/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2014-2022 mongoosejs
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
420
node_modules/kareem/README.md
generated
vendored
Normal file
420
node_modules/kareem/README.md
generated
vendored
Normal file
|
@ -0,0 +1,420 @@
|
|||
# kareem
|
||||
|
||||
[](https://travis-ci.org/vkarpov15/kareem)
|
||||
[](https://coveralls.io/r/vkarpov15/kareem)
|
||||
|
||||
Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, meant to offer additional flexibility in allowing you to execute hooks whenever necessary, as opposed to simply wrapping a single function.
|
||||
|
||||
Named for the NBA's all-time leading scorer Kareem Abdul-Jabbar, known for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook)
|
||||
|
||||
<img src="http://upload.wikimedia.org/wikipedia/commons/0/00/Kareem-Abdul-Jabbar_Lipofsky.jpg" width="220">
|
||||
|
||||
# API
|
||||
|
||||
## pre hooks
|
||||
|
||||
Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define
|
||||
pre and post hooks: pre hooks are called before a given function executes.
|
||||
Unlike hooks, kareem stores hooks and other internal state in a separate
|
||||
object, rather than relying on inheritance. Furthermore, kareem exposes
|
||||
an `execPre()` function that allows you to execute your pre hooks when
|
||||
appropriate, giving you more fine-grained control over your function hooks.
|
||||
|
||||
|
||||
#### It runs without any hooks specified
|
||||
|
||||
```javascript
|
||||
hooks.execPre('cook', null, function() {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
#### It runs basic serial pre hooks
|
||||
|
||||
pre hook functions take one parameter, a "done" function that you execute
|
||||
when your pre hook is finished.
|
||||
|
||||
|
||||
```javascript
|
||||
var count = 0;
|
||||
|
||||
hooks.pre('cook', function(done) {
|
||||
++count;
|
||||
done();
|
||||
});
|
||||
|
||||
hooks.execPre('cook', null, function() {
|
||||
assert.equal(1, count);
|
||||
});
|
||||
```
|
||||
|
||||
#### It can run multipe pre hooks
|
||||
|
||||
```javascript
|
||||
var count1 = 0;
|
||||
var count2 = 0;
|
||||
|
||||
hooks.pre('cook', function(done) {
|
||||
++count1;
|
||||
done();
|
||||
});
|
||||
|
||||
hooks.pre('cook', function(done) {
|
||||
++count2;
|
||||
done();
|
||||
});
|
||||
|
||||
hooks.execPre('cook', null, function() {
|
||||
assert.equal(1, count1);
|
||||
assert.equal(1, count2);
|
||||
});
|
||||
```
|
||||
|
||||
#### It can run fully synchronous pre hooks
|
||||
|
||||
If your pre hook function takes no parameters, its assumed to be
|
||||
fully synchronous.
|
||||
|
||||
|
||||
```javascript
|
||||
var count1 = 0;
|
||||
var count2 = 0;
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count1;
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count2;
|
||||
});
|
||||
|
||||
hooks.execPre('cook', null, function(error) {
|
||||
assert.equal(null, error);
|
||||
assert.equal(1, count1);
|
||||
assert.equal(1, count2);
|
||||
});
|
||||
```
|
||||
|
||||
#### It properly attaches context to pre hooks
|
||||
|
||||
Pre save hook functions are bound to the second parameter to `execPre()`
|
||||
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', function(done) {
|
||||
this.bacon = 3;
|
||||
done();
|
||||
});
|
||||
|
||||
hooks.pre('cook', function(done) {
|
||||
this.eggs = 4;
|
||||
done();
|
||||
});
|
||||
|
||||
var obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
// In the pre hooks, `this` will refer to `obj`
|
||||
hooks.execPre('cook', obj, function(error) {
|
||||
assert.equal(null, error);
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
});
|
||||
```
|
||||
|
||||
#### It can execute parallel (async) pre hooks
|
||||
|
||||
Like the hooks module, you can declare "async" pre hooks - these take two
|
||||
parameters, the functions `next()` and `done()`. `next()` passes control to
|
||||
the next pre hook, but the underlying function won't be called until all
|
||||
async pre hooks have called `done()`.
|
||||
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', true, function(next, done) {
|
||||
this.bacon = 3;
|
||||
next();
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 5);
|
||||
});
|
||||
|
||||
hooks.pre('cook', true, function(next, done) {
|
||||
next();
|
||||
var _this = this;
|
||||
setTimeout(function() {
|
||||
_this.eggs = 4;
|
||||
done();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
hooks.pre('cook', function(next) {
|
||||
this.waffles = false;
|
||||
next();
|
||||
});
|
||||
|
||||
var obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
hooks.execPre('cook', obj, function() {
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
});
|
||||
```
|
||||
|
||||
#### It supports returning a promise
|
||||
|
||||
You can also return a promise from your pre hooks instead of calling
|
||||
`next()`. When the returned promise resolves, kareem will kick off the
|
||||
next middleware.
|
||||
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', function() {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
this.bacon = 3;
|
||||
resolve();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
var obj = { bacon: 0 };
|
||||
|
||||
hooks.execPre('cook', obj, function() {
|
||||
assert.equal(3, obj.bacon);
|
||||
});
|
||||
```
|
||||
|
||||
## post hooks
|
||||
|
||||
acquit:ignore:end
|
||||
|
||||
#### It runs without any hooks specified
|
||||
|
||||
```javascript
|
||||
hooks.execPost('cook', null, [1], function(error, eggs) {
|
||||
assert.ifError(error);
|
||||
assert.equal(1, eggs);
|
||||
done();
|
||||
});
|
||||
```
|
||||
|
||||
#### It executes with parameters passed in
|
||||
|
||||
```javascript
|
||||
hooks.post('cook', function(eggs, bacon, callback) {
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
callback();
|
||||
});
|
||||
|
||||
hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) {
|
||||
assert.ifError(error);
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
});
|
||||
```
|
||||
|
||||
#### It can use synchronous post hooks
|
||||
|
||||
```javascript
|
||||
var execed = {};
|
||||
|
||||
hooks.post('cook', function(eggs, bacon) {
|
||||
execed.first = true;
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
});
|
||||
|
||||
hooks.post('cook', function(eggs, bacon, callback) {
|
||||
execed.second = true;
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
callback();
|
||||
});
|
||||
|
||||
hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) {
|
||||
assert.ifError(error);
|
||||
assert.equal(2, Object.keys(execed).length);
|
||||
assert.ok(execed.first);
|
||||
assert.ok(execed.second);
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
});
|
||||
```
|
||||
|
||||
#### It supports returning a promise
|
||||
|
||||
You can also return a promise from your post hooks instead of calling
|
||||
`next()`. When the returned promise resolves, kareem will kick off the
|
||||
next middleware.
|
||||
|
||||
|
||||
```javascript
|
||||
hooks.post('cook', function(bacon) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
this.bacon = 3;
|
||||
resolve();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
var obj = { bacon: 0 };
|
||||
|
||||
hooks.execPost('cook', obj, obj, function() {
|
||||
assert.equal(obj.bacon, 3);
|
||||
});
|
||||
```
|
||||
|
||||
## wrap()
|
||||
|
||||
acquit:ignore:end
|
||||
|
||||
#### It wraps pre and post calls into one call
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', true, function(next, done) {
|
||||
this.bacon = 3;
|
||||
next();
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 5);
|
||||
});
|
||||
|
||||
hooks.pre('cook', true, function(next, done) {
|
||||
next();
|
||||
var _this = this;
|
||||
setTimeout(function() {
|
||||
_this.eggs = 4;
|
||||
done();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
hooks.pre('cook', function(next) {
|
||||
this.waffles = false;
|
||||
next();
|
||||
});
|
||||
|
||||
hooks.post('cook', function(obj) {
|
||||
obj.tofu = 'no';
|
||||
});
|
||||
|
||||
var obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
var args = [obj];
|
||||
args.push(function(error, result) {
|
||||
assert.ifError(error);
|
||||
assert.equal(null, error);
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
assert.equal('no', obj.tofu);
|
||||
|
||||
assert.equal(obj, result);
|
||||
});
|
||||
|
||||
hooks.wrap(
|
||||
'cook',
|
||||
function(o, callback) {
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
assert.equal(undefined, obj.tofu);
|
||||
callback(null, o);
|
||||
},
|
||||
obj,
|
||||
args);
|
||||
```
|
||||
|
||||
## createWrapper()
|
||||
|
||||
#### It wraps wrap() into a callable function
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', true, function(next, done) {
|
||||
this.bacon = 3;
|
||||
next();
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 5);
|
||||
});
|
||||
|
||||
hooks.pre('cook', true, function(next, done) {
|
||||
next();
|
||||
var _this = this;
|
||||
setTimeout(function() {
|
||||
_this.eggs = 4;
|
||||
done();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
hooks.pre('cook', function(next) {
|
||||
this.waffles = false;
|
||||
next();
|
||||
});
|
||||
|
||||
hooks.post('cook', function(obj) {
|
||||
obj.tofu = 'no';
|
||||
});
|
||||
|
||||
var obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
var cook = hooks.createWrapper(
|
||||
'cook',
|
||||
function(o, callback) {
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
assert.equal(undefined, obj.tofu);
|
||||
callback(null, o);
|
||||
},
|
||||
obj);
|
||||
|
||||
cook(obj, function(error, result) {
|
||||
assert.ifError(error);
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
assert.equal('no', obj.tofu);
|
||||
|
||||
assert.equal(obj, result);
|
||||
});
|
||||
```
|
||||
|
||||
## clone()
|
||||
|
||||
acquit:ignore:end
|
||||
|
||||
#### It clones a Kareem object
|
||||
|
||||
```javascript
|
||||
var k1 = new Kareem();
|
||||
k1.pre('cook', function() {});
|
||||
k1.post('cook', function() {});
|
||||
|
||||
var k2 = k1.clone();
|
||||
assert.deepEqual(Array.from(k2._pres.keys()), ['cook']);
|
||||
assert.deepEqual(Array.from(k2._posts.keys()), ['cook']);
|
||||
```
|
||||
|
||||
## merge()
|
||||
|
||||
#### It pulls hooks from another Kareem object
|
||||
|
||||
```javascript
|
||||
var k1 = new Kareem();
|
||||
var test1 = function() {};
|
||||
k1.pre('cook', test1);
|
||||
k1.post('cook', function() {});
|
||||
|
||||
var k2 = new Kareem();
|
||||
var test2 = function() {};
|
||||
k2.pre('cook', test2);
|
||||
var k3 = k2.merge(k1);
|
||||
assert.equal(k3._pres.get('cook').length, 2);
|
||||
assert.equal(k3._pres.get('cook')[0].fn, test2);
|
||||
assert.equal(k3._pres.get('cook')[1].fn, test1);
|
||||
assert.equal(k3._posts.get('cook').length, 1);
|
||||
```
|
||||
|
668
node_modules/kareem/index.js
generated
vendored
Normal file
668
node_modules/kareem/index.js
generated
vendored
Normal file
|
@ -0,0 +1,668 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Create a new instance
|
||||
*/
|
||||
function Kareem() {
|
||||
this._pres = new Map();
|
||||
this._posts = new Map();
|
||||
}
|
||||
|
||||
Kareem.skipWrappedFunction = function skipWrappedFunction() {
|
||||
if (!(this instanceof Kareem.skipWrappedFunction)) {
|
||||
return new Kareem.skipWrappedFunction(...arguments);
|
||||
}
|
||||
|
||||
this.args = [...arguments];
|
||||
};
|
||||
|
||||
Kareem.overwriteResult = function overwriteResult() {
|
||||
if (!(this instanceof Kareem.overwriteResult)) {
|
||||
return new Kareem.overwriteResult(...arguments);
|
||||
}
|
||||
|
||||
this.args = [...arguments];
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "pre" hooks for "name"
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array|Function} args Optional arguments or directly the callback
|
||||
* @param {Function} [callback] The callback to call when executing all hooks are finished
|
||||
* @returns {void}
|
||||
*/
|
||||
Kareem.prototype.execPre = function(name, context, args, callback) {
|
||||
if (arguments.length === 3) {
|
||||
callback = args;
|
||||
args = [];
|
||||
}
|
||||
const pres = this._pres.get(name) || [];
|
||||
const numPres = pres.length;
|
||||
const numAsyncPres = pres.numAsync || 0;
|
||||
let currentPre = 0;
|
||||
let asyncPresLeft = numAsyncPres;
|
||||
let done = false;
|
||||
const $args = args;
|
||||
let shouldSkipWrappedFunction = null;
|
||||
|
||||
if (!numPres) {
|
||||
return nextTick(function() {
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
|
||||
function next() {
|
||||
if (currentPre >= numPres) {
|
||||
return;
|
||||
}
|
||||
const pre = pres[currentPre];
|
||||
|
||||
if (pre.isAsync) {
|
||||
const args = [
|
||||
decorateNextFn(_next),
|
||||
decorateNextFn(function(error) {
|
||||
if (error) {
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
if (error instanceof Kareem.skipWrappedFunction) {
|
||||
shouldSkipWrappedFunction = error;
|
||||
} else {
|
||||
done = true;
|
||||
return callback(error);
|
||||
}
|
||||
}
|
||||
if (--asyncPresLeft === 0 && currentPre >= numPres) {
|
||||
return callback(shouldSkipWrappedFunction);
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
callMiddlewareFunction(pre.fn, context, args, args[0]);
|
||||
} else if (pre.fn.length > 0) {
|
||||
const args = [decorateNextFn(_next)];
|
||||
const _args = arguments.length >= 2 ? arguments : [null].concat($args);
|
||||
for (let i = 1; i < _args.length; ++i) {
|
||||
if (i === _args.length - 1 && typeof _args[i] === 'function') {
|
||||
continue; // skip callbacks to avoid accidentally calling the callback from a hook
|
||||
}
|
||||
args.push(_args[i]);
|
||||
}
|
||||
|
||||
callMiddlewareFunction(pre.fn, context, args, args[0]);
|
||||
} else {
|
||||
let maybePromiseLike = null;
|
||||
try {
|
||||
maybePromiseLike = pre.fn.call(context);
|
||||
} catch (err) {
|
||||
if (err != null) {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (isPromiseLike(maybePromiseLike)) {
|
||||
maybePromiseLike.then(() => _next(), err => _next(err));
|
||||
} else {
|
||||
if (++currentPre >= numPres) {
|
||||
if (asyncPresLeft > 0) {
|
||||
// Leave parallel hooks to run
|
||||
return;
|
||||
} else {
|
||||
return nextTick(function() {
|
||||
callback(shouldSkipWrappedFunction);
|
||||
});
|
||||
}
|
||||
}
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next.apply(null, [null].concat(args));
|
||||
|
||||
function _next(error) {
|
||||
if (error) {
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
if (error instanceof Kareem.skipWrappedFunction) {
|
||||
shouldSkipWrappedFunction = error;
|
||||
} else {
|
||||
done = true;
|
||||
return callback(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (++currentPre >= numPres) {
|
||||
if (asyncPresLeft > 0) {
|
||||
// Leave parallel hooks to run
|
||||
return;
|
||||
} else {
|
||||
return callback(shouldSkipWrappedFunction);
|
||||
}
|
||||
}
|
||||
|
||||
next.apply(context, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "pre" hooks for "name" synchronously
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} [args] Apply custom arguments to the hook
|
||||
* @returns {void}
|
||||
*/
|
||||
Kareem.prototype.execPreSync = function(name, context, args) {
|
||||
const pres = this._pres.get(name) || [];
|
||||
const numPres = pres.length;
|
||||
|
||||
for (let i = 0; i < numPres; ++i) {
|
||||
pres[i].fn.apply(context, args || []);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "post" hooks for "name"
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array|Function} args Apply custom arguments to the hook
|
||||
* @param {*} options Optional options or directly the callback
|
||||
* @param {Function} [callback] The callback to call when executing all hooks are finished
|
||||
* @returns {void}
|
||||
*/
|
||||
Kareem.prototype.execPost = function(name, context, args, options, callback) {
|
||||
if (arguments.length < 5) {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
const posts = this._posts.get(name) || [];
|
||||
const numPosts = posts.length;
|
||||
let currentPost = 0;
|
||||
|
||||
let firstError = null;
|
||||
if (options && options.error) {
|
||||
firstError = options.error;
|
||||
}
|
||||
|
||||
if (!numPosts) {
|
||||
return nextTick(function() {
|
||||
callback.apply(null, [firstError].concat(args));
|
||||
});
|
||||
}
|
||||
|
||||
function next() {
|
||||
const post = posts[currentPost].fn;
|
||||
let numArgs = 0;
|
||||
const argLength = args.length;
|
||||
const newArgs = [];
|
||||
for (let i = 0; i < argLength; ++i) {
|
||||
numArgs += args[i] && args[i]._kareemIgnore ? 0 : 1;
|
||||
if (!args[i] || !args[i]._kareemIgnore) {
|
||||
newArgs.push(args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (firstError) {
|
||||
if (isErrorHandlingMiddleware(posts[currentPost], numArgs)) {
|
||||
const _cb = decorateNextFn(function(error) {
|
||||
if (error) {
|
||||
if (error instanceof Kareem.overwriteResult) {
|
||||
args = error.args;
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.call(null, firstError);
|
||||
}
|
||||
return next();
|
||||
}
|
||||
firstError = error;
|
||||
}
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.call(null, firstError);
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
callMiddlewareFunction(post, context,
|
||||
[firstError].concat(newArgs).concat([_cb]), _cb);
|
||||
} else {
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.call(null, firstError);
|
||||
}
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
const _cb = decorateNextFn(function(error) {
|
||||
if (error) {
|
||||
if (error instanceof Kareem.overwriteResult) {
|
||||
args = error.args;
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.apply(null, [null].concat(args));
|
||||
}
|
||||
return next();
|
||||
}
|
||||
firstError = error;
|
||||
return next();
|
||||
}
|
||||
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.apply(null, [null].concat(args));
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
if (isErrorHandlingMiddleware(posts[currentPost], numArgs)) {
|
||||
// Skip error handlers if no error
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.apply(null, [null].concat(args));
|
||||
}
|
||||
return next();
|
||||
}
|
||||
if (post.length === numArgs + 1) {
|
||||
callMiddlewareFunction(post, context, newArgs.concat([_cb]), _cb);
|
||||
} else {
|
||||
let error;
|
||||
let maybePromiseLike;
|
||||
try {
|
||||
maybePromiseLike = post.apply(context, newArgs);
|
||||
} catch (err) {
|
||||
error = err;
|
||||
firstError = err;
|
||||
}
|
||||
|
||||
if (isPromiseLike(maybePromiseLike)) {
|
||||
return maybePromiseLike.then(
|
||||
(res) => {
|
||||
_cb(res instanceof Kareem.overwriteResult ? res : null);
|
||||
},
|
||||
err => _cb(err)
|
||||
);
|
||||
}
|
||||
|
||||
if (maybePromiseLike instanceof Kareem.overwriteResult) {
|
||||
args = maybePromiseLike.args;
|
||||
}
|
||||
|
||||
if (++currentPost >= numPosts) {
|
||||
return callback.apply(null, [error].concat(args));
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "post" hooks for "name" synchronously
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array|Function} args Apply custom arguments to the hook
|
||||
* @returns {Array} The used arguments
|
||||
*/
|
||||
Kareem.prototype.execPostSync = function(name, context, args) {
|
||||
const posts = this._posts.get(name) || [];
|
||||
const numPosts = posts.length;
|
||||
|
||||
for (let i = 0; i < numPosts; ++i) {
|
||||
const res = posts[i].fn.apply(context, args || []);
|
||||
if (res instanceof Kareem.overwriteResult) {
|
||||
args = res.args;
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a synchronous wrapper for "fn"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Function} fn The function to wrap
|
||||
* @returns {Function} The wrapped function
|
||||
*/
|
||||
Kareem.prototype.createWrapperSync = function(name, fn) {
|
||||
const _this = this;
|
||||
return function syncWrapper() {
|
||||
_this.execPreSync(name, this, arguments);
|
||||
|
||||
const toReturn = fn.apply(this, arguments);
|
||||
|
||||
const result = _this.execPostSync(name, this, [toReturn]);
|
||||
|
||||
return result[0];
|
||||
};
|
||||
};
|
||||
|
||||
function _handleWrapError(instance, error, name, context, args, options, callback) {
|
||||
if (options.useErrorHandlers) {
|
||||
return instance.execPost(name, context, args, { error: error }, function(error) {
|
||||
return typeof callback === 'function' && callback(error);
|
||||
});
|
||||
} else {
|
||||
return typeof callback === 'function' && callback(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes pre hooks, followed by the wrapped function, followed by post hooks.
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Function} fn The function for the hook
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} args Apply custom arguments to the hook
|
||||
* @param {Object} [options]
|
||||
* @param {Boolean} [options.checkForPromise]
|
||||
* @returns {void}
|
||||
*/
|
||||
Kareem.prototype.wrap = function(name, fn, context, args, options) {
|
||||
const lastArg = (args.length > 0 ? args[args.length - 1] : null);
|
||||
const argsWithoutCb = Array.from(args);
|
||||
typeof lastArg === 'function' && argsWithoutCb.pop();
|
||||
const _this = this;
|
||||
|
||||
options = options || {};
|
||||
const checkForPromise = options.checkForPromise;
|
||||
|
||||
this.execPre(name, context, args, function(error) {
|
||||
if (error && !(error instanceof Kareem.skipWrappedFunction)) {
|
||||
const numCallbackParams = options.numCallbackParams || 0;
|
||||
const errorArgs = options.contextParameter ? [context] : [];
|
||||
for (let i = errorArgs.length; i < numCallbackParams; ++i) {
|
||||
errorArgs.push(null);
|
||||
}
|
||||
return _handleWrapError(_this, error, name, context, errorArgs,
|
||||
options, lastArg);
|
||||
}
|
||||
|
||||
const numParameters = fn.length;
|
||||
let ret;
|
||||
|
||||
if (error instanceof Kareem.skipWrappedFunction) {
|
||||
ret = error.args[0];
|
||||
return _cb(null, ...error.args);
|
||||
} else {
|
||||
try {
|
||||
ret = fn.apply(context, argsWithoutCb.concat(_cb));
|
||||
} catch (err) {
|
||||
return _cb(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (checkForPromise) {
|
||||
if (isPromiseLike(ret)) {
|
||||
// Thenable, use it
|
||||
return ret.then(
|
||||
res => _cb(null, res),
|
||||
err => _cb(err)
|
||||
);
|
||||
}
|
||||
|
||||
// If `fn()` doesn't have a callback argument and doesn't return a
|
||||
// promise, assume it is sync
|
||||
if (numParameters < argsWithoutCb.length + 1) {
|
||||
return _cb(null, ret);
|
||||
}
|
||||
}
|
||||
|
||||
function _cb() {
|
||||
const argsWithoutError = Array.from(arguments);
|
||||
argsWithoutError.shift();
|
||||
if (options.nullResultByDefault && argsWithoutError.length === 0) {
|
||||
argsWithoutError.push(null);
|
||||
}
|
||||
if (arguments[0]) {
|
||||
// Assume error
|
||||
return _handleWrapError(_this, arguments[0], name, context,
|
||||
argsWithoutError, options, lastArg);
|
||||
} else {
|
||||
_this.execPost(name, context, argsWithoutError, function() {
|
||||
if (lastArg === null) {
|
||||
return;
|
||||
}
|
||||
arguments[0]
|
||||
? lastArg(arguments[0])
|
||||
: lastArg.apply(context, arguments);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter current instance for something specific and return the filtered clone
|
||||
* @param {Function} fn The filter function
|
||||
* @returns {Kareem} The cloned and filtered instance
|
||||
*/
|
||||
Kareem.prototype.filter = function(fn) {
|
||||
const clone = this.clone();
|
||||
|
||||
const pres = Array.from(clone._pres.keys());
|
||||
for (const name of pres) {
|
||||
const hooks = this._pres.get(name).
|
||||
map(h => Object.assign({}, h, { name: name })).
|
||||
filter(fn);
|
||||
|
||||
if (hooks.length === 0) {
|
||||
clone._pres.delete(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
hooks.numAsync = hooks.filter(h => h.isAsync).length;
|
||||
|
||||
clone._pres.set(name, hooks);
|
||||
}
|
||||
|
||||
const posts = Array.from(clone._posts.keys());
|
||||
for (const name of posts) {
|
||||
const hooks = this._posts.get(name).
|
||||
map(h => Object.assign({}, h, { name: name })).
|
||||
filter(fn);
|
||||
|
||||
if (hooks.length === 0) {
|
||||
clone._posts.delete(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
clone._posts.set(name, hooks);
|
||||
}
|
||||
|
||||
return clone;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check for a "name" to exist either in pre or post hooks
|
||||
* @param {String} name The name of the hook
|
||||
* @returns {Boolean} "true" if found, "false" otherwise
|
||||
*/
|
||||
Kareem.prototype.hasHooks = function(name) {
|
||||
return this._pres.has(name) || this._posts.has(name);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a Wrapper for "fn" on "name" and return the wrapped function
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Function} fn The function to wrap
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Object} [options]
|
||||
* @returns {Function} The wrapped function
|
||||
*/
|
||||
Kareem.prototype.createWrapper = function(name, fn, context, options) {
|
||||
const _this = this;
|
||||
if (!this.hasHooks(name)) {
|
||||
// Fast path: if there's no hooks for this function, just return the
|
||||
// function wrapped in a nextTick()
|
||||
return function() {
|
||||
nextTick(() => fn.apply(this, arguments));
|
||||
};
|
||||
}
|
||||
return function() {
|
||||
const _context = context || this;
|
||||
_this.wrap(name, fn, _context, Array.from(arguments), options);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new hook for "pre"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Boolean} [isAsync]
|
||||
* @param {Function} fn The function to register for "name"
|
||||
* @param {never} error Unused
|
||||
* @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
|
||||
* @returns {Kareem}
|
||||
*/
|
||||
Kareem.prototype.pre = function(name, isAsync, fn, error, unshift) {
|
||||
let options = {};
|
||||
if (typeof isAsync === 'object' && isAsync !== null) {
|
||||
options = isAsync;
|
||||
isAsync = options.isAsync;
|
||||
} else if (typeof arguments[1] !== 'boolean') {
|
||||
fn = isAsync;
|
||||
isAsync = false;
|
||||
}
|
||||
|
||||
const pres = this._pres.get(name) || [];
|
||||
this._pres.set(name, pres);
|
||||
|
||||
if (isAsync) {
|
||||
pres.numAsync = pres.numAsync || 0;
|
||||
++pres.numAsync;
|
||||
}
|
||||
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error('pre() requires a function, got "' + typeof fn + '"');
|
||||
}
|
||||
|
||||
if (unshift) {
|
||||
pres.unshift(Object.assign({}, options, { fn: fn, isAsync: isAsync }));
|
||||
} else {
|
||||
pres.push(Object.assign({}, options, { fn: fn, isAsync: isAsync }));
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new hook for "post"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Object} [options]
|
||||
* @param {Function} fn The function to register for "name"
|
||||
* @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
|
||||
* @returns {Kareem}
|
||||
*/
|
||||
Kareem.prototype.post = function(name, options, fn, unshift) {
|
||||
const posts = this._posts.get(name) || [];
|
||||
|
||||
if (typeof options === 'function') {
|
||||
unshift = !!fn;
|
||||
fn = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error('post() requires a function, got "' + typeof fn + '"');
|
||||
}
|
||||
|
||||
if (unshift) {
|
||||
posts.unshift(Object.assign({}, options, { fn: fn }));
|
||||
} else {
|
||||
posts.push(Object.assign({}, options, { fn: fn }));
|
||||
}
|
||||
this._posts.set(name, posts);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone the current instance
|
||||
* @returns {Kareem} The cloned instance
|
||||
*/
|
||||
Kareem.prototype.clone = function() {
|
||||
const n = new Kareem();
|
||||
|
||||
for (const key of this._pres.keys()) {
|
||||
const clone = this._pres.get(key).slice();
|
||||
clone.numAsync = this._pres.get(key).numAsync;
|
||||
n._pres.set(key, clone);
|
||||
}
|
||||
for (const key of this._posts.keys()) {
|
||||
n._posts.set(key, this._posts.get(key).slice());
|
||||
}
|
||||
|
||||
return n;
|
||||
};
|
||||
|
||||
/**
|
||||
* Merge "other" into self or "clone"
|
||||
* @param {Kareem} other The instance to merge with
|
||||
* @param {Kareem} [clone] The instance to merge onto (if not defined, using "this")
|
||||
* @returns {Kareem} The merged instance
|
||||
*/
|
||||
Kareem.prototype.merge = function(other, clone) {
|
||||
clone = arguments.length === 1 ? true : clone;
|
||||
const ret = clone ? this.clone() : this;
|
||||
|
||||
for (const key of other._pres.keys()) {
|
||||
const sourcePres = ret._pres.get(key) || [];
|
||||
const deduplicated = other._pres.get(key).
|
||||
// Deduplicate based on `fn`
|
||||
filter(p => sourcePres.map(_p => _p.fn).indexOf(p.fn) === -1);
|
||||
const combined = sourcePres.concat(deduplicated);
|
||||
combined.numAsync = sourcePres.numAsync || 0;
|
||||
combined.numAsync += deduplicated.filter(p => p.isAsync).length;
|
||||
ret._pres.set(key, combined);
|
||||
}
|
||||
for (const key of other._posts.keys()) {
|
||||
const sourcePosts = ret._posts.get(key) || [];
|
||||
const deduplicated = other._posts.get(key).
|
||||
filter(p => sourcePosts.indexOf(p) === -1);
|
||||
ret._posts.set(key, sourcePosts.concat(deduplicated));
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
function callMiddlewareFunction(fn, context, args, next) {
|
||||
let maybePromiseLike;
|
||||
try {
|
||||
maybePromiseLike = fn.apply(context, args);
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
}
|
||||
|
||||
if (isPromiseLike(maybePromiseLike)) {
|
||||
maybePromiseLike.then(() => next(), err => next(err));
|
||||
}
|
||||
}
|
||||
|
||||
function isPromiseLike(v) {
|
||||
return (typeof v === 'object' && v !== null && typeof v.then === 'function');
|
||||
}
|
||||
|
||||
function decorateNextFn(fn) {
|
||||
let called = false;
|
||||
const _this = this;
|
||||
return function() {
|
||||
// Ensure this function can only be called once
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
// Make sure to clear the stack so try/catch doesn't catch errors
|
||||
// in subsequent middleware
|
||||
return nextTick(() => fn.apply(_this, arguments));
|
||||
};
|
||||
}
|
||||
|
||||
const nextTick = typeof process === 'object' && process !== null && process.nextTick || function nextTick(cb) {
|
||||
setTimeout(cb, 0);
|
||||
};
|
||||
|
||||
function isErrorHandlingMiddleware(post, numArgs) {
|
||||
if (post.errorHandler) {
|
||||
return true;
|
||||
}
|
||||
return post.fn.length === numArgs + 2;
|
||||
}
|
||||
|
||||
module.exports = Kareem;
|
31
node_modules/kareem/package.json
generated
vendored
Normal file
31
node_modules/kareem/package.json
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "kareem",
|
||||
"version": "2.5.1",
|
||||
"description": "Next-generation take on pre/post function hooks",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha ./test/*",
|
||||
"test-coverage": "nyc --reporter lcov mocha ./test/*",
|
||||
"docs": "node ./docs.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/vkarpov15/kareem.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acquit": "1.x",
|
||||
"acquit-ignore": "0.2.x",
|
||||
"eslint": "8.20.0",
|
||||
"mocha": "9.2.0",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"author": "Valeri Karpov <val@karpov.io>",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue