feat(@vates/decorate-with): 0.0.1
This commit is contained in:
parent
9ded2641a7
commit
c4121073ad
45
@vates/decorate-with/README.md
Normal file
45
@vates/decorate-with/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
|
||||||
|
|
||||||
|
# @vates/decorate-with
|
||||||
|
|
||||||
|
[](https://npmjs.org/package/@vates/decorate-with)  [](https://bundlephobia.com/result?p=@vates/decorate-with) [](https://npmjs.org/package/@vates/decorate-with)
|
||||||
|
|
||||||
|
> Creates a decorator from a function wrapper
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Installation of the [npm package](https://npmjs.org/package/@vates/decorate-with):
|
||||||
|
|
||||||
|
```
|
||||||
|
> npm install --save @vates/decorate-with
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
For instance, allows using Lodash's functions as decorators:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { decorateWith } from '@vates/decorate-with'
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
@decorateWith(lodash.debounce, 150)
|
||||||
|
bar() {
|
||||||
|
// body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
|
Contributions are _very_ welcomed, either on the documentation or on
|
||||||
|
the code.
|
||||||
|
|
||||||
|
You may:
|
||||||
|
|
||||||
|
- report any [issue](https://github.com/vatesfr/xen-orchestra/issues)
|
||||||
|
you've encountered;
|
||||||
|
- fork and create a pull request.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[ISC](https://spdx.org/licenses/ISC) © [Vates SAS](https://vates.fr)
|
12
@vates/decorate-with/USAGE.md
Normal file
12
@vates/decorate-with/USAGE.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
For instance, allows using Lodash's functions as decorators:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { decorateWith } from '@vates/decorate-with'
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
@decorateWith(lodash.debounce, 150)
|
||||||
|
bar() {
|
||||||
|
// body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
4
@vates/decorate-with/index.js
Normal file
4
@vates/decorate-with/index.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
exports.decorateWith = (fn, ...args) => (target, name, descriptor) => ({
|
||||||
|
...descriptor,
|
||||||
|
value: fn(descriptor.value, ...args),
|
||||||
|
})
|
30
@vates/decorate-with/package.json
Normal file
30
@vates/decorate-with/package.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"private": false,
|
||||||
|
"name": "@vates/decorate-with",
|
||||||
|
"description": "Creates a decorator from a function wrapper",
|
||||||
|
"keywords": [
|
||||||
|
"apply",
|
||||||
|
"decorator",
|
||||||
|
"factory",
|
||||||
|
"wrapper"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/decorate-with",
|
||||||
|
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||||
|
"repository": {
|
||||||
|
"directory": "@vates/decorate-with",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "Vates SAS",
|
||||||
|
"url": "https://vates.fr"
|
||||||
|
},
|
||||||
|
"license": "ISC",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postversion": "npm publish --access public"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user