playjs-core 0.6.9 → 0.7.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 +29 -0
- package/dist/index.es.js +3918 -3929
- package/dist/index.umd.js +69 -70
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,35 @@ import { PlayJS } from 'playjs-core';
|
|
|
43
43
|
<PlayJS theme="light" />
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## Testing Helpers
|
|
47
|
+
|
|
48
|
+
PlayJS includes a minimal testing API available inside the editor:
|
|
49
|
+
|
|
50
|
+
- `expect(actual).eq(expected)`
|
|
51
|
+
- `expect(actual).neq(expected)`
|
|
52
|
+
- `expect(actual).truthy()`
|
|
53
|
+
- `expect(actual).falsy()`
|
|
54
|
+
- `cases(fn, [[input, expected], ...])`
|
|
55
|
+
|
|
56
|
+
### Examples
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
expect(2 + 2).eq(4)
|
|
60
|
+
// ➜ '✓' 4 'eq' 4
|
|
61
|
+
|
|
62
|
+
expect(2 + 2).eq(5)
|
|
63
|
+
// ➜ '✗' 4 'eq' 5
|
|
64
|
+
|
|
65
|
+
expect(0).falsy()
|
|
66
|
+
// ➜ '✓' 0 'falsy' false
|
|
67
|
+
|
|
68
|
+
function double(n){ return n * 2 }
|
|
69
|
+
cases(double, [[1,2],[3,6],[5,10]])
|
|
70
|
+
// ➜ '✓' 2 'eq' 2 ┊ '✓' 6 'eq' 6 ┊ '✓' 10 'eq' 10
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
These helpers log concise results to the Console pane without requiring any imports.
|
|
74
|
+
|
|
46
75
|
## Contributing
|
|
47
76
|
|
|
48
77
|
If you think PlayJS is a cool project and you would like to do your bit, check out [**How to Contribute**](HOW_TO_CONTRIBUTE.md) for more information.
|