@evlop/commons 1.0.314 → 1.0.315

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.
@@ -1,3 +1,3 @@
1
- export declare const useScope: (scopeVariable?: string | Function, defaultValue?: any) => any;
1
+ export declare const useScope: (scopeSelector?: string | Function, defaultValue?: any) => any;
2
2
  export { useScope as useData };
3
3
  //# sourceMappingURL=useScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,GAAG,QAAQ,EAAE,eAAe,GAAG,QAQ7E,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,GAAI,gBAAe,MAAM,GAAG,QAA+B,EAAE,eAAe,GAAG,QAOnG,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
@@ -4,15 +4,15 @@ exports.useData = exports.useScope = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const react_1 = require("react");
6
6
  const contexts_1 = require("../contexts");
7
- const useScope = (scopeVariable, defaultValue) => {
7
+ const defaultScopeSelector = (scope) => scope;
8
+ const useScope = (scopeSelector = defaultScopeSelector, defaultValue) => {
8
9
  const scope = (0, react_1.useContext)(contexts_1.DataContext);
9
- if (typeof scopeVariable === 'string') {
10
- return (0, lodash_1.get)(scope, scopeVariable, defaultValue);
10
+ if (typeof scopeSelector === 'string') {
11
+ return (0, lodash_1.get)(scope, scopeSelector, defaultValue);
11
12
  }
12
- else if (typeof scopeVariable === 'function') {
13
- return scopeVariable(scope);
13
+ else {
14
+ return scopeSelector?.(scope);
14
15
  }
15
- return scope;
16
16
  };
17
17
  exports.useScope = useScope;
18
18
  exports.useData = exports.useScope;
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":";;;AAAA,mCAA6B;AAC7B,iCAAmC;AACnC,0CAA0C;AAEnC,MAAM,QAAQ,GAAG,CAAC,aAAiC,EAAE,YAAkB,EAAC,EAAE;IAC7E,MAAM,KAAK,GAAS,IAAA,kBAAU,EAAC,sBAAW,CAAC,CAAC;IAC5C,IAAG,OAAO,aAAa,KAAK,QAAQ,EAAC,CAAC;QAClC,OAAO,IAAA,YAAG,EAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAM,IAAG,OAAO,aAAa,KAAK,UAAU,EAAC,CAAC;QAC3C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,QAAQ,YAQnB;AAEkB,kBAVP,gBAAQ,CAUM"}
1
+ {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":";;;AAAA,mCAA6B;AAC7B,iCAAmC;AACnC,0CAA0C;AAE1C,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAC,EAAE,CAAC,KAAK,CAAC;AAE3C,MAAM,QAAQ,GAAG,CAAC,gBAAmC,oBAAoB,EAAE,YAAkB,EAAC,EAAE;IACnG,MAAM,KAAK,GAAS,IAAA,kBAAU,EAAC,sBAAW,CAAC,CAAC;IAC5C,IAAG,OAAO,aAAa,KAAK,QAAQ,EAAC,CAAC;QAClC,OAAO,IAAA,YAAG,EAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAK,CAAC;QACH,OAAO,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB;AAEkB,kBATP,gBAAQ,CASM"}
@@ -1,3 +1,3 @@
1
- export declare const useScope: (scopeVariable?: string | Function, defaultValue?: any) => any;
1
+ export declare const useScope: (scopeSelector?: string | Function, defaultValue?: any) => any;
2
2
  export { useScope as useData };
3
3
  //# sourceMappingURL=useScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,GAAG,QAAQ,EAAE,eAAe,GAAG,QAQ7E,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,GAAI,gBAAe,MAAM,GAAG,QAA+B,EAAE,eAAe,GAAG,QAOnG,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import { get } from 'lodash';
2
2
  import { useContext } from 'react';
3
3
  import { DataContext } from '../contexts';
4
- export const useScope = (scopeVariable, defaultValue) => {
4
+ const defaultScopeSelector = (scope) => scope;
5
+ export const useScope = (scopeSelector = defaultScopeSelector, defaultValue) => {
5
6
  const scope = useContext(DataContext);
6
- if (typeof scopeVariable === 'string') {
7
- return get(scope, scopeVariable, defaultValue);
7
+ if (typeof scopeSelector === 'string') {
8
+ return get(scope, scopeSelector, defaultValue);
8
9
  }
9
- else if (typeof scopeVariable === 'function') {
10
- return scopeVariable(scope);
10
+ else {
11
+ return scopeSelector?.(scope);
11
12
  }
12
- return scope;
13
13
  };
14
14
  export { useScope as useData };
15
15
  //# sourceMappingURL=useScope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAA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AAQ,IAAI,OAAO,EAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const useScope: (scopeVariable?: string | Function, defaultValue?: any) => any;
1
+ export declare const useScope: (scopeSelector?: string | Function, defaultValue?: any) => any;
2
2
  export { useScope as useData };
3
3
  //# sourceMappingURL=useScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,GAAG,QAAQ,EAAE,eAAe,GAAG,QAQ7E,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,GAAI,gBAAe,MAAM,GAAG,QAA+B,EAAE,eAAe,GAAG,QAOnG,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evlop/commons",
3
- "version": "1.0.314",
3
+ "version": "1.0.315",
4
4
  "description": "",
5
5
  "main": "dist/cjs/main.js",
6
6
  "module": "dist/esm/main.js",