@pistachiojs/core 0.3.0-dev.0 → 0.3.0
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 +7 -7
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pistachiojs/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Framework-agnostic, pure utility functions for common programming tasks and reusable across any JavaScript or TypeScript environment.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@pistachiojs/core)
|
|
6
6
|
[](../../coverage)
|
|
@@ -34,11 +34,11 @@ yarn add @pistachiojs/core
|
|
|
34
34
|
```javascript
|
|
35
35
|
import { isArray, toCamelCase } from '@pistachiojs/core'
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// type checking
|
|
38
38
|
isArray([1, 2, 3]) // true
|
|
39
39
|
isArray('hello') // false
|
|
40
40
|
|
|
41
|
-
//
|
|
41
|
+
// string transformation
|
|
42
42
|
toCamelCase('hello-world') // 'helloWorld'
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -47,11 +47,11 @@ toCamelCase('hello-world') // 'helloWorld'
|
|
|
47
47
|
```javascript
|
|
48
48
|
const { isArray, toCamelCase } = require('@pistachiojs/core')
|
|
49
49
|
|
|
50
|
-
//
|
|
50
|
+
// type checking
|
|
51
51
|
isArray([1, 2, 3]) // true
|
|
52
52
|
isArray('hello') // false
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// string transformation
|
|
55
55
|
toCamelCase('hello-world') // 'helloWorld'
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -62,11 +62,11 @@ This package is written in TypeScript and includes type definitions out of the b
|
|
|
62
62
|
```typescript
|
|
63
63
|
import { map, isString } from '@pistachiojs/core'
|
|
64
64
|
|
|
65
|
-
//
|
|
65
|
+
// full type inference
|
|
66
66
|
const numbers: number[] = [1, 2, 3]
|
|
67
67
|
const doubled = map(numbers, (n) => n * 2) // number[]
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// type guards narrow types
|
|
70
70
|
function process(value: unknown) {
|
|
71
71
|
if (isString(value)) {
|
|
72
72
|
// value is now typed as string
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pistachiojs/core",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.3.0
|
|
3
|
+
"description": "Framework-agnostic pure utility functions for common programming tasks",
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"author": "Dirga Prakesha <dirga.prakesha@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"typescript",
|
|
15
15
|
"javascript",
|
|
16
16
|
"helpers",
|
|
17
|
-
"functional",
|
|
18
17
|
"framework-agnostic",
|
|
19
18
|
"type-safe",
|
|
20
19
|
"tree-shakeable"
|