@webkrafters/react-observable-context 1.1.4 → 2.0.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 CHANGED
@@ -12,13 +12,17 @@ npm install --save @webkrafters/react-observable-context
12
12
 
13
13
  ## API
14
14
 
15
- The React-Observable-Context package exports only **2** modules namely: the **createContext** method and the **Provider** component.
15
+ The React-Observable-Context package exports **3** modules namely: the **createContext** method, the **useContext** hook and the **Provider** component.
16
16
 
17
- `createContext` is a zero-parameter funtion returning a store-bearing context. Pass the context to the React::useContext() parameter to obtain the context's `store`.
17
+ * **createContext** is a zero-parameter funtion returning a store-bearing context. Pass the context to the React::useContext() parameter to obtain the context's `store`.
18
18
 
19
- The `Provider` can immediately be used as-is anywhere the React-Observable-Context is required. It accepts **3** props and the customary Provider `children` prop. Supply the context to its `context` prop; the initial state to the customary Provider `value` prop; and the optional `prehooks` prop <i>(discussed in the prehooks section below)</i>.
19
+ * **useContext** is analogous to React::useContext hook but returns the context store and takes a second parameter named ***watchedKeys***. The `watchedKeys` parameter is a list of state object property names to watch. Change in any of the referenced properties automatically triggers a render of the component calling this hook.
20
20
 
21
- <i><u>Note:</u></i> the Provider `context` prop is not updateable. Once set, all further updates to this prop are not recorded.
21
+ * **Provider** can immediately be used as-is anywhere the React-Observable-Context is required. It accepts **3** props and the customary Provider `children` prop. Supply the context to its `context` prop; the initial state to the customary Provider `value` prop; and the optional `prehooks` prop <i>(discussed in the prehooks section below)</i>.
22
+
23
+ ***<u>Note:</u>*** the Provider `context` prop is not updateable. Once set, all further updates to this prop are not recorded.
24
+
25
+ ### The Store
22
26
 
23
27
  The context's `store` exposes **4** methods for interacting with the context's internal state namely:
24
28
 
@@ -38,7 +42,7 @@ The context's store update operation adheres to **2** user supplied prehooks whe
38
42
 
39
43
  * **setState**: (newChanges: PartialState\<State\>) => boolean
40
44
 
41
- ***usecase***: prehooks provide a central place for sanitizing, modifying, transforming, validating etc. all related incoming state updates. The prehook returns a **boolean** value (`true` to continue OR `false` to abort the update operation). The prehook may mutate (i.e. sanitize, transform, transpose) its argument values to accurately reflect the intended update value.
45
+ ***<u>Use case:</u>*** prehooks provide a central place for sanitizing, modifying, transforming, validating etc. all related incoming state updates. The prehook returns a **boolean** value (`true` to continue AND `false` to abort the update operation). The prehook may mutate (i.e. sanitize, transform, transpose) its argument values to accurately reflect the intended update value.
42
46
 
43
47
  ## Usage
44
48
 
@@ -50,7 +54,9 @@ The context's store update operation adheres to **2** user supplied prehooks whe
50
54
 
51
55
  <i><u>reset.js</u></i>
52
56
 
53
- import React, { useContext } from 'react';
57
+ import React, { useEffect } from 'react';
58
+
59
+ import { useContext } from '@webkrafters/react-observable-context';
54
60
 
55
61
  import ObservableContext from './context';
56
62
 
@@ -68,22 +74,19 @@ The context's store update operation adheres to **2** user supplied prehooks whe
68
74
 
69
75
  <i><u>tally-display.js</u></i>
70
76
 
71
- import React, { useContext, useEffect, useState } from 'react';
77
+ import React, { useEffect } from 'react';
78
+
79
+ import { useContext } from '@webkrafters/react-observable-context';
72
80
 
73
81
  import ObservableContext from './context';
74
82
 
75
83
  import Reset from './reset';
76
84
 
77
- const TallyDisplay = () => {
85
+ const CONTEXT_KEYS = [ 'color', 'price', 'type' ];
78
86
 
79
- const { getState, subscribe } = useContext( ObservableContext );
87
+ const TallyDisplay = () => {
80
88
 
81
- const [ , tripRender ] = useState( false );
82
-
83
- useEffect(() => subscribe( newValue => {
84
- [ 'color', 'price', 'type' ].some( k => k in newValue ) &&
85
- tripRender( s => !s );
86
- }), []);
89
+ const { getState } = useContext( ObservableContext, CONTEXT_KEYS );
87
90
 
88
91
  useEffect(() => console.log( 'TallyDisplay component rendered.....' ));
89
92
 
@@ -108,7 +111,9 @@ The context's store update operation adheres to **2** user supplied prehooks whe
108
111
 
109
112
  <i><u>editor.js</u></i>
110
113
 
111
- import React, { useCallback, useContext, useEffect, useRef } from 'react';
114
+ import React, { useCallback, useEffect, useRef } from 'react';
115
+
116
+ import { useContext } from '@webkrafters/react-observable-context';
112
117
 
113
118
  import ObservableContext from './context';
114
119
 
@@ -152,7 +157,7 @@ The context's store update operation adheres to **2** user supplied prehooks whe
152
157
  { ' ' }
153
158
  <button onClick={ updateType }>update type</button>
154
159
  </div>
155
- </fieldset>
160
+ </fieldset>
156
161
  );
157
162
  };
158
163
  Editor.displayName = 'Editor';
@@ -161,20 +166,17 @@ The context's store update operation adheres to **2** user supplied prehooks whe
161
166
 
162
167
  <i><u>product-description.js</u></i>
163
168
 
164
- import React, { useContext, useEffect, useState } from 'react';
169
+ import React, { useEffect } from 'react';
170
+
171
+ import { useContext } from '@webkrafters/react-observable-context';
165
172
 
166
173
  import ObservableContext from './context';
174
+
175
+ const CONTEXT_KEYS = [ 'color', 'type' ];
167
176
 
168
177
  const ProductDescription = () => {
169
178
 
170
- const store = useContext( ObservableContext );
171
-
172
- const [ , tripRender ] = useState( false );
173
-
174
- useEffect(() => store.subscribe( newValue => {
175
- ( 'color' in newValue || 'type' in newValue ) &&
176
- tripRender( s => !s );
177
- } ), []);
179
+ const store = useContext( ObservableContext, CONTEXT_KEYS );
178
180
 
179
181
  useEffect(() => console.log( 'ProductDescription component rendered.....' ));
180
182
 
@@ -193,25 +195,23 @@ The context's store update operation adheres to **2** user supplied prehooks whe
193
195
 
194
196
  <i><u>price-sticker.js</u></i>
195
197
 
196
- import React, { useContext, useEffect, useState } from 'react';
198
+ import React, { useEffect } from 'react';
199
+
200
+ import { useContext } from '@webkrafters/react-observable-context';
197
201
 
198
202
  import ObservableContext from './context';
203
+
204
+ const CONTEXT_KEYS = [ 'price' ];
199
205
 
200
206
  const PriceSticker = () => {
201
207
 
202
- const store = useContext( ObservableContext );
203
-
204
- const [ price, setPrice ] = useState(() => store.getState( s => s.price ));
205
-
206
- useEffect(() => store.subscribe( newValue => {
207
- 'price' in newValue && setPrice( newValue.price );
208
- } ), []);
208
+ const { getState } = useContext( ObservableContext, CONTEXT_KEYS );
209
209
 
210
210
  useEffect(() => console.log( 'PriceSticker component rendered.....' ));
211
211
 
212
212
  return (
213
213
  <div style={{ fontSize: 36, fontWeight: 800 }}>
214
- ${ price.toFixed( 2 ) }
214
+ ${ getState( s => s.price ).toFixed( 2 ) }
215
215
  </div>
216
216
  );
217
217
  };
@@ -251,11 +251,11 @@ The context's store update operation adheres to **2** user supplied prehooks whe
251
251
  <div style={{ marginBottom: 10 }}>
252
252
  <label>$ <input onKeyUp={ overridePricing } placeholder="override price here..."/></label>
253
253
  </div>
254
- <Provider
255
- context={ ObservableContext }
256
- prehooks={ prehooks }
257
- value={ state }
258
- >
254
+ <Provider
255
+ context={ ObservableContext }
256
+ prehooks={ prehooks }
257
+ value={ state }
258
+ >
259
259
  <div style={{
260
260
  borderBottom: '1px solid #333',
261
261
  marginBottom: 10,
@@ -286,7 +286,7 @@ The context's store update operation adheres to **2** user supplied prehooks whe
286
286
 
287
287
  const updateType = useCallback( e => setProductType( e.target.value ), [] );
288
288
 
289
- const prehooks = React.useMemo(() => ({
289
+ const prehooks = useMemo(() => ({
290
290
  resetState: ( ...args ) => {
291
291
  console.log( 'resetting state with >>>> ', JSON.stringify( args ) );
292
292
  return true;
package/dist/index.d.ts CHANGED
@@ -1,24 +1,25 @@
1
1
  export class UsageError extends Error {
2
2
  }
3
- export function createContext<T_1 extends State>(): import("react").Context<Store<T_1>>;
3
+ export function createContext<T_1 extends State>(): React.Context<Store<T_2>>;
4
+ export function useContext<T_1 extends State>(context: React.Context<Store<T_2>>, watchedKeys?: (keyof T_1)[]): Store<T_1>;
4
5
  /**
5
6
  * Note: `context` prop is not updateable. Furtther updates to this prop are ignored.
6
7
  *
7
- * @type {import("react").FC<{
8
- * children?: import("react").ReactNode,
8
+ * @type {React.FC<{
9
+ * children?: React.ReactNode,
9
10
  * context: ObservableContext<T>,
10
11
  * prehooks?: Prehooks<T>
11
- * value: T
12
+ * value: PartialState<T>
12
13
  * }>}
13
14
  * @template {State} T
14
15
  */
15
- export const Provider: import("react").FC<{
16
- children?: import("react").ReactNode;
17
- context: ObservableContext<T>;
16
+ export const Provider: React.FC<{
17
+ children?: React.ReactNode;
18
+ context: React.Context<Store<T_1>>;
18
19
  prehooks?: Prehooks<T>;
19
- value: T;
20
+ value: PartialState<T>;
20
21
  }>;
21
- export type ObservableContext<T_1 extends State> = import("react").Context<Store<T>>;
22
+ export type ObservableContext<T_1 extends State> = React.Context<Store<T>>;
22
23
  export type OptionalTask<F = void> = F extends void ? () => never : F;
23
24
  export type Listener<T_1 extends State> = (newValue: PartialState<T>, oldValue: PartialState<T>) => void;
24
25
  export type State = {
package/dist/index.js CHANGED
@@ -4,10 +4,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.createContext = exports.UsageError = exports.Provider = void 0;
7
+ exports.useContext = exports.createContext = exports.UsageError = exports.Provider = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
10
- var _lodash2 = _interopRequireDefault(require("lodash.isempty"));
10
+ var _lodash2 = _interopRequireDefault(require("lodash.has"));
11
+ var _lodash3 = _interopRequireDefault(require("lodash.isempty"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -67,12 +68,45 @@ var createContext = function createContext() {
67
68
  });
68
69
  };
69
70
 
71
+ /**
72
+ * Actively monitors the store and triggers component re-render if any of the watched keys in the state objects changes
73
+ *
74
+ * @param {ObservableContext<T>} context
75
+ * @param {Array<keyof T>} [watchedKeys = []] Names of state properties to watch. A change in any of the referenced properties results in this component render.
76
+ * @returns {Store<T>}
77
+ * @template {State} T
78
+ */
79
+ exports.createContext = createContext;
80
+ var useContext = function useContext(context) {
81
+ var watchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
82
+ var store = (0, _react.useContext)(context);
83
+ var _useState = (0, _react.useState)(false),
84
+ _useState2 = _slicedToArray(_useState, 2),
85
+ tripRender = _useState2[1];
86
+ var watched = (0, _react.useMemo)(function () {
87
+ return Array.isArray(watchedKeys) ? Array.from(new Set(watchedKeys)) : [];
88
+ }, [watchedKeys]);
89
+ (0, _react.useEffect)(function () {
90
+ if (!watched.length) {
91
+ return;
92
+ }
93
+ return store.subscribe(function (newChanges) {
94
+ watched.some(function (w) {
95
+ return (0, _lodash2["default"])(newChanges, w);
96
+ }) && tripRender(function (s) {
97
+ return !s;
98
+ });
99
+ });
100
+ }, [watched]);
101
+ return store;
102
+ };
103
+
70
104
  /**
71
105
  * @readonly
72
106
  * @type {Prehooks<T>}
73
107
  * @template {State} T
74
108
  */
75
- exports.createContext = createContext;
109
+ exports.useContext = useContext;
76
110
  var defaultPrehooks = Object.freeze({});
77
111
 
78
112
  /**
@@ -94,7 +128,7 @@ var _setState = function _setState(state, newState, onStateChange) {
94
128
  state[k] = newState[k];
95
129
  newChanges[k] = newState[k];
96
130
  }
97
- !(0, _lodash2["default"])(newChanges) && onStateChange(newChanges, replacedValue);
131
+ !(0, _lodash3["default"])(newChanges) && onStateChange(newChanges, replacedValue);
98
132
  };
99
133
 
100
134
  /**
@@ -112,11 +146,11 @@ var usePrehooksRef = function usePrehooksRef(prehooks) {
112
146
  /**
113
147
  * Note: `context` prop is not updateable. Furtther updates to this prop are ignored.
114
148
  *
115
- * @type {import("react").FC<{
116
- * children?: import("react").ReactNode,
149
+ * @type {React.FC<{
150
+ * children?: React.ReactNode,
117
151
  * context: ObservableContext<T>,
118
152
  * prehooks?: Prehooks<T>
119
- * value: T
153
+ * value: PartialState<T>
120
154
  * }>}
121
155
  * @template {State} T
122
156
  */
@@ -131,21 +165,21 @@ var Provider = function Provider(_ref) {
131
165
  var initialState = (0, _react.useRef)(value);
132
166
 
133
167
  /** @type {[Set<Listener<T>>, Function]} */
134
- var _useState = (0, _react.useState)(function () {
168
+ var _useState3 = (0, _react.useState)(function () {
135
169
  return new Set();
136
170
  }),
137
- _useState2 = _slicedToArray(_useState, 1),
138
- listeners = _useState2[0];
171
+ _useState4 = _slicedToArray(_useState3, 1),
172
+ listeners = _useState4[0];
139
173
  /** @type {[T, Function]} */
140
- var _useState3 = (0, _react.useState)(function () {
174
+ var _useState5 = (0, _react.useState)(function () {
141
175
  return (0, _lodash["default"])(value);
142
176
  }),
143
- _useState4 = _slicedToArray(_useState3, 1),
144
- state = _useState4[0];
145
- /** @type {ObservableContext<T>} */
146
- var _useState5 = (0, _react.useState)(context),
147
177
  _useState6 = _slicedToArray(_useState5, 1),
148
- StoreContext = _useState6[0];
178
+ state = _useState6[0];
179
+ /** @type {ObservableContext<T>} */
180
+ var _useState7 = (0, _react.useState)(context),
181
+ _useState8 = _slicedToArray(_useState7, 1),
182
+ StoreContext = _useState8[0];
149
183
 
150
184
  /** @type {Listener<T>} */
151
185
  var onChange = function onChange(newValue, oldValue) {
@@ -187,7 +221,7 @@ var Provider = function Provider(_ref) {
187
221
  }, [value]);
188
222
 
189
223
  /** @type {[Store<T>, Function]} */
190
- var _useState7 = (0, _react.useState)(function () {
224
+ var _useState9 = (0, _react.useState)(function () {
191
225
  return {
192
226
  getState: getState,
193
227
  resetState: resetState,
@@ -195,8 +229,8 @@ var Provider = function Provider(_ref) {
195
229
  subscribe: subscribe
196
230
  };
197
231
  }),
198
- _useState8 = _slicedToArray(_useState7, 1),
199
- store = _useState8[0];
232
+ _useState10 = _slicedToArray(_useState9, 1),
233
+ store = _useState10[0];
200
234
  return /*#__PURE__*/_react["default"].createElement(StoreContext.Provider, {
201
235
  value: store
202
236
  }, children);
@@ -205,7 +239,7 @@ exports.Provider = Provider;
205
239
  Provider.displayName = 'ObservableContext.Provider';
206
240
 
207
241
  /**
208
- * @typedef {import("react").Context<Store<T>>} ObservableContext
242
+ * @typedef {React.Context<Store<T>>} ObservableContext
209
243
  * @template {State} T
210
244
  */
211
245
 
package/package.json CHANGED
@@ -1,79 +1,80 @@
1
- {
2
- "author": "Stephen Isienyi <stephen.isienyi@webkrafting.com>",
3
- "bugs": {
4
- "url": "https://github.com/steveswork/react-observable-context/issues"
5
- },
6
- "contributors": [
7
- "steveswork <stephen.isienyi@webkrafting.com> (https://github.com/steveswork)"
8
- ],
9
- "dependencies": {
10
- "@types/react": "^18.0.17",
11
- "lodash.clonedeep": "^4.5.0",
12
- "lodash.isempty": "^4.4.0",
13
- "react": "^18.2.0"
14
- },
15
- "description": "Observable react context - prevents an automatic total component tree tear-down and re-rendering during context updates.",
16
- "devDependencies": {
17
- "@babel/cli": "^7.17.0",
18
- "@babel/core": "^7.12.10",
19
- "@babel/node": "^7.12.10",
20
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
21
- "@babel/plugin-transform-runtime": "^7.17.0",
22
- "@babel/preset-env": "^7.12.11",
23
- "@babel/preset-react": "^7.18.6",
24
- "@testing-library/jest-dom": "^5.16.5",
25
- "@testing-library/react": "^13.4.0",
26
- "@testing-library/user-event": "^14.4.3",
27
- "@types/jest-cli": "^24.3.0",
28
- "babel-jest": "^26.6.3",
29
- "babel-loader": "^8.2.5",
30
- "eslint": "^7.15.0",
31
- "eslint-config-standard": "^16.0.2",
32
- "eslint-plugin-import": "^2.22.1",
33
- "eslint-plugin-jest": "^24.1.3",
34
- "eslint-plugin-node": "^11.1.0",
35
- "eslint-plugin-promise": "^4.2.1",
36
- "eslint-plugin-react": "^7.31.11",
37
- "eslint-plugin-standard": "^5.0.0",
38
- "jest-cli": "^26.6.3",
39
- "react-dom": "^18.2.0",
40
- "react-performance-testing": "^2.0.0",
41
- "typescript": "^4.8.2"
42
- },
43
- "files": [
44
- "dist/index.js",
45
- "dist/index.d.ts",
46
- "index",
47
- "package.json"
48
- ],
49
- "homepage": "https://github.com/steveswork/react-observable-context#readme",
50
- "jest": {
51
- "transform": {
52
- "\\.[jt]sx?$": "babel-jest"
53
- }
54
- },
55
- "keywords": [
56
- "context",
57
- "react-hooks",
58
- "react-context",
59
- "react",
60
- "useContext"
61
- ],
62
- "license": "MIT",
63
- "main": "index.js",
64
- "name": "@webkrafters/react-observable-context",
65
- "publishConfig": {
66
- "access": "public"
67
- },
68
- "repository": {
69
- "type": "git",
70
- "url": "git+https://github.com/steveswork/react-observable-context.git"
71
- },
72
- "scripts": {
73
- "build": "eslint --fix && rm -rf dist && babel src -d dist && npx -p typescript tsc",
74
- "test": "eslint --fix && jest",
75
- "test:watch": "eslint --fix && jest --watchAll"
76
- },
77
- "types": "dist/index.d.ts",
78
- "version": "1.1.4"
79
- }
1
+ {
2
+ "author": "Stephen Isienyi <stephen.isienyi@webkrafting.com>",
3
+ "bugs": {
4
+ "url": "https://github.com/steveswork/react-observable-context/issues"
5
+ },
6
+ "contributors": [
7
+ "steveswork <stephen.isienyi@webkrafting.com> (https://github.com/steveswork)"
8
+ ],
9
+ "dependencies": {
10
+ "@types/react": "^18.0.17",
11
+ "lodash.clonedeep": "^4.5.0",
12
+ "lodash.has": "^4.5.2",
13
+ "lodash.isempty": "^4.4.0",
14
+ "react": "^18.2.0"
15
+ },
16
+ "description": "Observable react context - prevents an automatic total component tree tear-down and re-rendering during context updates.",
17
+ "devDependencies": {
18
+ "@babel/cli": "^7.17.0",
19
+ "@babel/core": "^7.12.10",
20
+ "@babel/node": "^7.12.10",
21
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
22
+ "@babel/plugin-transform-runtime": "^7.17.0",
23
+ "@babel/preset-env": "^7.12.11",
24
+ "@babel/preset-react": "^7.18.6",
25
+ "@testing-library/jest-dom": "^5.16.5",
26
+ "@testing-library/react": "^13.4.0",
27
+ "@testing-library/user-event": "^14.4.3",
28
+ "@types/jest-cli": "^24.3.0",
29
+ "babel-jest": "^26.6.3",
30
+ "babel-loader": "^8.2.5",
31
+ "eslint": "^7.15.0",
32
+ "eslint-config-standard": "^16.0.2",
33
+ "eslint-plugin-import": "^2.22.1",
34
+ "eslint-plugin-jest": "^24.1.3",
35
+ "eslint-plugin-node": "^11.1.0",
36
+ "eslint-plugin-promise": "^4.2.1",
37
+ "eslint-plugin-react": "^7.31.11",
38
+ "eslint-plugin-standard": "^5.0.0",
39
+ "jest-cli": "^26.6.3",
40
+ "react-dom": "^18.2.0",
41
+ "react-performance-testing": "^2.0.0",
42
+ "typescript": "^4.8.2"
43
+ },
44
+ "files": [
45
+ "dist/index.js",
46
+ "dist/index.d.ts",
47
+ "index",
48
+ "package.json"
49
+ ],
50
+ "homepage": "https://github.com/steveswork/react-observable-context#readme",
51
+ "jest": {
52
+ "transform": {
53
+ "\\.[jt]sx?$": "babel-jest"
54
+ }
55
+ },
56
+ "keywords": [
57
+ "context",
58
+ "react-hooks",
59
+ "react-context",
60
+ "react",
61
+ "useContext"
62
+ ],
63
+ "license": "MIT",
64
+ "main": "index.js",
65
+ "name": "@webkrafters/react-observable-context",
66
+ "publishConfig": {
67
+ "access": "public"
68
+ },
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://github.com/steveswork/react-observable-context.git"
72
+ },
73
+ "scripts": {
74
+ "build": "eslint --fix && rm -rf dist && babel src -d dist && npx -p typescript tsc",
75
+ "test": "eslint --fix && jest",
76
+ "test:watch": "eslint --fix && jest --watchAll"
77
+ },
78
+ "types": "dist/index.d.ts",
79
+ "version": "2.0.0"
80
+ }