Skip to content

Commit e1642c8

Browse files
committed
added transpilation
1 parent 8460dba commit e1642c8

23 files changed

+2231
-112
lines changed

.babelrc

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"env": {
3+
"es5": {
4+
"plugins": [
5+
"transform-runtime"
6+
],
7+
"presets": [
8+
["env", {
9+
"loose": true,
10+
"modules": false
11+
}]
12+
]
13+
},
14+
"es5-cjs": {
15+
"plugins": [
16+
"transform-runtime",
17+
"transform-es2015-modules-commonjs",
18+
"add-module-exports"
19+
],
20+
"presets": [
21+
["env", {
22+
"loose": true
23+
}]
24+
]
25+
},
26+
"es2015": {
27+
"plugins": [
28+
"babel-plugin-transform-object-entries"
29+
]
30+
},
31+
"es2015-cjs": {
32+
"plugins": [
33+
"babel-plugin-transform-object-entries",
34+
"add-module-exports",
35+
"transform-es2015-modules-commonjs"
36+
]
37+
}
38+
}
39+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
node_modules
22
bower_components
3+
/es5
4+
/es2015
5+
.DS_Store

.npmignore

Whitespace-only changes.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ Diesis is a declarative dependency injection library.
77
It allows to define a group of functions in a graph of dependencies, removing the manual wiring necessary to connect the functions one another. It also ensures every dependency is executed at most once.
88
It works with functions returning synchronously or asynchronously (returning a promise).
99

10+
Importing diesis
11+
----------------
12+
You can import diesis as ES module or using commonjs:
13+
```js
14+
import { dependency } from 'diesis'
15+
16+
const dependency = require('diesis').dependency
17+
```
18+
The library is compatible with ES2015 (ES6). You can also import an ES5 transpiled version with:
19+
```js
20+
import { dependency } from 'diesis/es5'
21+
22+
const dependency = require('diesis/es5').dependency
23+
```
24+
1025
Using diesis
1126
------------
1227
Let's start with 2 simple functions, one depending on another:
@@ -173,6 +188,7 @@ If the decorated function throws an exception or returns a rejected promise, thi
173188

174189
The decorator uses a LRU cache algorithm to decide whether to get rid of a cached value.
175190
It also supports a time-to-live for cached values. But you have to consider stale cache entries are not removed until the size of the cache exceeds the length. This allows to keep the running time of the algorithm constant (O(1)) for any operation.
191+
The cache is local to the process. So multiple process will store multiple cache items.
176192
```js
177193
const cacheDependency = require('diesis').cacheDependency
178194
const cacheTTL = cacheDependency({ len: 1, ttl: 1 })

0 commit comments

Comments
 (0)