atomic-fns 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/package.json +2 -2
- package/tests/globals.spec.ts +3 -1
package/README.md
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# atomic-fns
|
|
2
|
+
|
|
3
|
+
## Like Lodash, but for ESNext and with types.
|
|
4
|
+
|
|
5
|
+
Stop shipping code built for browsers from 2015. Really though, look at the [issues](https://github.com/lodash/lodash/issues/2930#issuecomment-370295020).
|
|
6
|
+
|
|
7
|
+
* Modular: Pick what you need. Works with all bundlers and also supports tree-shaking.
|
|
8
|
+
* Native: Uses newer data structures and control flow techniques.
|
|
9
|
+
* Lazy: Leverages generators, iterators and functional composition.
|
|
10
|
+
* Fluent: Pure functions and abstract classes. Include only what you need.
|
|
11
|
+
* TypeScript & JSDoc: Supports both TypeScript and latest JS spec. JSDoc for best in class experience.
|
|
12
|
+
|
|
13
|
+
This library is available as an npm package. To install the package just run:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install atomic-fns
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How to use
|
|
20
|
+
```typescript
|
|
21
|
+
import { id, reversed, sorted, times, uniqueId } from 'atomic-fns'
|
|
22
|
+
|
|
23
|
+
reverse([1, 2, 3, 4])
|
|
24
|
+
// => [4, 3, 2, 1]
|
|
25
|
+
|
|
26
|
+
sorted([4, 3, 2, 1])
|
|
27
|
+
// => [1, 2, 3, 4]
|
|
28
|
+
|
|
29
|
+
times(5, id)
|
|
30
|
+
// => [0, 1, 2, 3, 4]
|
|
31
|
+
|
|
32
|
+
times(5, id)
|
|
33
|
+
// => [0, 1, 2, 3, 4]
|
|
34
|
+
|
|
35
|
+
uniqueId('user_')
|
|
36
|
+
// => 'user_101225005'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Docs
|
|
40
|
+
|
|
41
|
+
🛠 Under construction.
|
|
42
|
+
|
|
43
|
+
💡 See the `src` directory for comments.
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atomic-fns",
|
|
3
3
|
"description": "A general-purpose and forward looking toolbox for evergreen JS code standards.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/adrian2x/
|
|
44
|
+
"url": "git+https://github.com/adrian2x/atomic-fns.git"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"es-next",
|
package/tests/globals.spec.ts
CHANGED
|
@@ -119,7 +119,9 @@ describe('globals', () => {
|
|
|
119
119
|
it('uniqueId', () => {
|
|
120
120
|
const uid = uniqueId()
|
|
121
121
|
assert(isNumber(uid))
|
|
122
|
-
|
|
122
|
+
let prefix = 'user_'
|
|
123
|
+
const userId = uniqueId('user_')
|
|
124
|
+
assert(userId.startsWith('user_'))
|
|
123
125
|
})
|
|
124
126
|
|
|
125
127
|
it('call', () => {
|