@m4l/core 0.0.22 → 0.0.23

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.
@@ -0,0 +1,34 @@
1
+ import { createContext, useState, useCallback } from "react";
2
+ import { v as voidFunction } from "../../utils/index.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const initialState = {
5
+ flags: [],
6
+ clearFlags: voidFunction,
7
+ addFlag: voidFunction
8
+ };
9
+ const FlagsContext = createContext(initialState);
10
+ function FlagsProvider({
11
+ children
12
+ }) {
13
+ const [flags, setFlags] = useState([]);
14
+ const clearFlags = useCallback(() => {
15
+ setFlags([]);
16
+ }, []);
17
+ const addFlag = useCallback((newFlag) => {
18
+ setFlags((oldFlags) => {
19
+ if (oldFlags.findIndex((f) => f === newFlag) < 0) {
20
+ return [...oldFlags, newFlag];
21
+ }
22
+ return [...oldFlags];
23
+ });
24
+ }, []);
25
+ return /* @__PURE__ */ jsx(FlagsContext.Provider, {
26
+ value: {
27
+ flags,
28
+ addFlag,
29
+ clearFlags
30
+ },
31
+ children
32
+ });
33
+ }
34
+ export { FlagsContext as F, FlagsProvider as a };
@@ -1,5 +1,5 @@
1
1
  import { createContext, useState } from "react";
2
- import { v as voidFunction } from "./voidFunction.js";
2
+ import { v as voidFunction } from "../../utils/index.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  const initialValue = {
5
5
  toast: () => 0,
@@ -0,0 +1,88 @@
1
+ import { createContext, useState, useLayoutEffect, useCallback } from "react";
2
+ import { u as useHostTools } from "../../hooks/useHostTools/index.js";
3
+ import { u as useNetwork } from "../../hooks/useNetwork/index.js";
4
+ import { u as useEnvironment } from "../../hooks/useEnvironment/index.js";
5
+ import { u as useFlags } from "../../hooks/useFlags/index.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ const initialState = {
8
+ getLabel: () => "..",
9
+ getModuleLabel: () => "No dictionary context"
10
+ };
11
+ const ModuleDictionaryContext = createContext(initialState);
12
+ function ModuleDictionaryProvider(props) {
13
+ const {
14
+ children,
15
+ componentsDictionary,
16
+ moduleId,
17
+ moduleName = "module_name",
18
+ currentLang = "us",
19
+ isAuth = true
20
+ } = props;
21
+ const {
22
+ addFlag
23
+ } = useFlags();
24
+ const [moduleDictionary, setModuleDictionary] = useState(void 0);
25
+ const {
26
+ domain_token
27
+ } = useEnvironment();
28
+ const {
29
+ startProgress,
30
+ stopProgress
31
+ } = useHostTools();
32
+ const {
33
+ networkOperation
34
+ } = useNetwork();
35
+ useLayoutEffect(() => {
36
+ let mounted = true;
37
+ startProgress();
38
+ networkOperation({
39
+ method: "GET",
40
+ endPoint: isAuth ? `dictionaries/${moduleId}` : `na/dictionaries/${moduleId}`,
41
+ parms: {
42
+ comps: componentsDictionary,
43
+ ...isAuth ? {} : {
44
+ domain_token
45
+ }
46
+ }
47
+ }).then((response) => {
48
+ if (mounted) {
49
+ setModuleDictionary({
50
+ ...response
51
+ });
52
+ addFlag("dictionary_loaded");
53
+ }
54
+ }).finally(() => {
55
+ stopProgress();
56
+ });
57
+ return function cleanUp() {
58
+ mounted = false;
59
+ };
60
+ }, [currentLang]);
61
+ const getLabel = useCallback((key) => {
62
+ if (moduleDictionary === void 0)
63
+ return "No dictionary";
64
+ if (key === void 0)
65
+ return "No key";
66
+ const parts = key.split(".");
67
+ if (parts.length === 2) {
68
+ if (moduleDictionary[parts[0]] && moduleDictionary[parts[0]][parts[1]]) {
69
+ return moduleDictionary[parts[0]][parts[1]];
70
+ }
71
+ } else if (parts.length === 1) {
72
+ if (moduleDictionary.data && moduleDictionary.data[key]) {
73
+ return moduleDictionary.data[key];
74
+ }
75
+ }
76
+ return `No dictionary:${key}`;
77
+ }, [moduleDictionary]);
78
+ const getModuleLabel = useCallback(() => getLabel(moduleName), [moduleName, getLabel]);
79
+ return /* @__PURE__ */ jsx(ModuleDictionaryContext.Provider, {
80
+ value: {
81
+ moduleDictionary,
82
+ getLabel,
83
+ getModuleLabel
84
+ },
85
+ children
86
+ });
87
+ }
88
+ export { ModuleDictionaryContext as M, ModuleDictionaryProvider as a };
@@ -1,6 +1,6 @@
1
1
  import { createContext, useCallback } from "react";
2
- import { u as useEnvironment } from "./useEnvironment.js";
3
- import { u as useHostTools } from "./useHostTools.js";
2
+ import { u as useEnvironment } from "../../hooks/useEnvironment/index.js";
3
+ import { u as useHostTools } from "../../hooks/useHostTools/index.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  const initialValue = {
6
6
  networkOperation: () => Promise.resolve()
@@ -1,5 +1,5 @@
1
1
  import { s as snakecaseKeys } from "./snakecase-keys.js";
2
- import { E as EmitEvents } from "./vendor.js";
2
+ import { E as EmitEvents } from "../types/index.js";
3
3
  var axios$2 = { exports: {} };
4
4
  var bind$2 = function bind(fn, thisArg) {
5
5
  return function wrap() {
@@ -1,4 +1,4 @@
1
- import { m as mapObj, r as require$$1 } from "./vendor.js";
1
+ import { m as mapObj, r as require$$1 } from "../node_modules.js";
2
2
  const map = mapObj.exports;
3
3
  const { snakeCase } = require$$1;
4
4
  var snakecaseKeys = function(obj, options) {
@@ -1,5 +1,5 @@
1
1
  import { useContext } from "react";
2
- import { E as EnvironmentContext } from "./EnvironmentContext.js";
2
+ import { E as EnvironmentContext } from "../../contexts/EnvironmentContext/index.js";
3
3
  const useEnvironment = () => {
4
4
  const context = useContext(EnvironmentContext);
5
5
  if (!context)
@@ -0,0 +1,9 @@
1
+ import { useContext } from "react";
2
+ import { F as FlagsContext } from "../../contexts/FlagsContext/index.js";
3
+ const useFlags = () => {
4
+ const context = useContext(FlagsContext);
5
+ if (!context)
6
+ throw new Error("useFlags context must be use inside FlagsProvider");
7
+ return context;
8
+ };
9
+ export { useFlags as u };
@@ -1,5 +1,5 @@
1
1
  import { useContext } from "react";
2
- import { H as HostToolsContext } from "./HostToolsContext.js";
2
+ import { H as HostToolsContext } from "../../contexts/HostToolsContext/index.js";
3
3
  const useHostTools = () => {
4
4
  const context = useContext(HostToolsContext);
5
5
  if (!context)
@@ -0,0 +1,2 @@
1
+ import "react";
2
+ import "../../contexts/ModuleDictionaryContext/index.js";
@@ -1,5 +1,5 @@
1
1
  import { useContext } from "react";
2
- import { N as NetworkContext } from "./NetworkContext.js";
2
+ import { N as NetworkContext } from "../../contexts/NetworkContext/index.js";
3
3
  const useNetwork = () => {
4
4
  const context = useContext(NetworkContext);
5
5
  if (!context)
package/dist/index.js CHANGED
@@ -1,13 +1,18 @@
1
- export { E as EnvironmentContext, a as EnvironmentProvider } from "./EnvironmentContext.js";
2
- export { H as HostToolsContext, a as HostToolsProvider } from "./HostToolsContext.js";
3
- export { N as NetworkContext, a as NetworkProvider } from "./NetworkContext.js";
4
- export { E as EmitEvents, F as FlagsContext, a as FlagsProvider, M as ModuleDictionaryContext, b as ModuleDictionaryProvider, c as getLocalStorage, g as getPropertyByString, s as setLocalStorage, u as useFlags } from "./vendor.js";
5
- export { u as useEnvironment } from "./useEnvironment.js";
6
- export { u as useHostTools } from "./useHostTools.js";
7
- export { u as useLocalStorage } from "./useLocalStorage.js";
8
- export { u as useNetwork } from "./useNetwork.js";
9
- export { v as voidFunction } from "./voidFunction.js";
10
- export { a as axiosOperation } from "./axios.js";
1
+ export { E as EnvironmentContext, a as EnvironmentProvider } from "./contexts/EnvironmentContext/index.js";
2
+ export { H as HostToolsContext, a as HostToolsProvider } from "./contexts/HostToolsContext/index.js";
3
+ export { N as NetworkContext, a as NetworkProvider } from "./contexts/NetworkContext/index.js";
4
+ export { F as FlagsContext, a as FlagsProvider } from "./contexts/FlagsContext/index.js";
5
+ export { M as ModuleDictionaryContext, a as ModuleDictionaryProvider } from "./contexts/ModuleDictionaryContext/index.js";
6
+ export { u as useEnvironment } from "./hooks/useEnvironment/index.js";
7
+ export { u as useFlags } from "./hooks/useFlags/index.js";
8
+ export { u as useHostTools } from "./hooks/useHostTools/index.js";
9
+ export { u as useLocalStorage } from "./hooks/useLocalStorage/index.js";
10
+ export { u as useNetwork } from "./hooks/useNetwork/index.js";
11
+ export { E as EmitEvents } from "./types/index.js";
12
+ export { a as getLocalStorage, g as getPropertyByString, s as setLocalStorage, v as voidFunction } from "./utils/index.js";
13
+ export { a as axiosOperation } from "./external/axios.js";
11
14
  import "react";
12
15
  import "react/jsx-runtime";
13
- import "./snakecase-keys.js";
16
+ import "./node_modules.js";
17
+ import "./vendor.js";
18
+ import "./external/snakecase-keys.js";
@@ -0,0 +1,100 @@
1
+ import { g as getAugmentedNamespace } from "./vendor.js";
2
+ var mapObj = { exports: {} };
3
+ const isObject = (value) => typeof value === "object" && value !== null;
4
+ const mapObjectSkip = Symbol("skip");
5
+ const isObjectCustom = (value) => isObject(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
6
+ const mapObject = (object, mapper, options, isSeen = /* @__PURE__ */ new WeakMap()) => {
7
+ options = {
8
+ deep: false,
9
+ target: {},
10
+ ...options
11
+ };
12
+ if (isSeen.has(object)) {
13
+ return isSeen.get(object);
14
+ }
15
+ isSeen.set(object, options.target);
16
+ const { target } = options;
17
+ delete options.target;
18
+ const mapArray = (array) => array.map((element) => isObjectCustom(element) ? mapObject(element, mapper, options, isSeen) : element);
19
+ if (Array.isArray(object)) {
20
+ return mapArray(object);
21
+ }
22
+ for (const [key, value] of Object.entries(object)) {
23
+ const mapResult = mapper(key, value, object);
24
+ if (mapResult === mapObjectSkip) {
25
+ continue;
26
+ }
27
+ let [newKey, newValue, { shouldRecurse = true } = {}] = mapResult;
28
+ if (newKey === "__proto__") {
29
+ continue;
30
+ }
31
+ if (options.deep && shouldRecurse && isObjectCustom(newValue)) {
32
+ newValue = Array.isArray(newValue) ? mapArray(newValue) : mapObject(newValue, mapper, options, isSeen);
33
+ }
34
+ target[newKey] = newValue;
35
+ }
36
+ return target;
37
+ };
38
+ mapObj.exports = (object, mapper, options) => {
39
+ if (!isObject(object)) {
40
+ throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
41
+ }
42
+ return mapObject(object, mapper, options);
43
+ };
44
+ mapObj.exports.mapObjectSkip = mapObjectSkip;
45
+ var __assign = function() {
46
+ __assign = Object.assign || function __assign2(t) {
47
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
48
+ s = arguments[i];
49
+ for (var p in s)
50
+ if (Object.prototype.hasOwnProperty.call(s, p))
51
+ t[p] = s[p];
52
+ }
53
+ return t;
54
+ };
55
+ return __assign.apply(this, arguments);
56
+ };
57
+ function lowerCase(str) {
58
+ return str.toLowerCase();
59
+ }
60
+ var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
61
+ var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
62
+ function noCase(input, options) {
63
+ if (options === void 0) {
64
+ options = {};
65
+ }
66
+ var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
67
+ var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
68
+ var start = 0;
69
+ var end = result.length;
70
+ while (result.charAt(start) === "\0")
71
+ start++;
72
+ while (result.charAt(end - 1) === "\0")
73
+ end--;
74
+ return result.slice(start, end).split("\0").map(transform).join(delimiter);
75
+ }
76
+ function replace(input, re, value) {
77
+ if (re instanceof RegExp)
78
+ return input.replace(re, value);
79
+ return re.reduce(function(input2, re2) {
80
+ return input2.replace(re2, value);
81
+ }, input);
82
+ }
83
+ function dotCase(input, options) {
84
+ if (options === void 0) {
85
+ options = {};
86
+ }
87
+ return noCase(input, __assign({ delimiter: "." }, options));
88
+ }
89
+ function snakeCase(input, options) {
90
+ if (options === void 0) {
91
+ options = {};
92
+ }
93
+ return dotCase(input, __assign({ delimiter: "_" }, options));
94
+ }
95
+ const dist_es2015 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
96
+ __proto__: null,
97
+ snakeCase
98
+ }, Symbol.toStringTag, { value: "Module" }));
99
+ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(dist_es2015);
100
+ export { mapObj as m, require$$1 as r };
@@ -0,0 +1,6 @@
1
+ var EmitEvents = /* @__PURE__ */ ((EmitEvents2) => {
2
+ EmitEvents2["EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED"] = `netsevice_unauthorized`;
3
+ EmitEvents2["EMMIT_EVENT_HOST_THEME_CHANGE"] = "host_theme_change";
4
+ return EmitEvents2;
5
+ })(EmitEvents || {});
6
+ export { EmitEvents as E };
@@ -0,0 +1,33 @@
1
+ import "../external/axios.js";
2
+ import "../node_modules.js";
3
+ function voidFunction() {
4
+ }
5
+ function getPropertyByString(object, propString) {
6
+ let value = object;
7
+ const props = propString.split(".");
8
+ for (let index = 0; index < props.length; index += 1) {
9
+ if (props[index] === void 0)
10
+ break;
11
+ value = value[props[index]];
12
+ }
13
+ return value;
14
+ }
15
+ function getLocalStorage(key, initialValue) {
16
+ try {
17
+ const item = window.localStorage.getItem(key);
18
+ return item !== null ? JSON.parse(item) : initialValue;
19
+ } catch (e) {
20
+ return initialValue;
21
+ }
22
+ }
23
+ function setLocalStorage(key, value) {
24
+ try {
25
+ const item = window.localStorage.getItem(key);
26
+ let newValue = item !== null ? JSON.parse(item) : {};
27
+ newValue = { ...newValue, ...value };
28
+ window.localStorage.setItem(key, JSON.stringify(newValue));
29
+ } catch (e) {
30
+ console.error(e);
31
+ }
32
+ }
33
+ export { getLocalStorage as a, getPropertyByString as g, setLocalStorage as s, voidFunction as v };
package/dist/vendor.js CHANGED
@@ -1,164 +1,17 @@
1
- import { createContext, useState, useCallback, useContext, useLayoutEffect } from "react";
2
- import "./HostToolsContext.js";
3
- import "./NetworkContext.js";
4
- import "./EnvironmentContext.js";
5
- import "./axios.js";
6
- import { v as voidFunction } from "./voidFunction.js";
7
- import { jsx } from "react/jsx-runtime";
8
- import { u as useHostTools } from "./useHostTools.js";
9
- import { u as useNetwork } from "./useNetwork.js";
10
- import { u as useEnvironment } from "./useEnvironment.js";
11
- import "./useLocalStorage.js";
12
- const initialState$1 = {
13
- flags: [],
14
- clearFlags: voidFunction,
15
- addFlag: voidFunction
16
- };
17
- const FlagsContext = createContext(initialState$1);
18
- function FlagsProvider({
19
- children
20
- }) {
21
- const [flags, setFlags] = useState([]);
22
- const clearFlags = useCallback(() => {
23
- setFlags([]);
24
- }, []);
25
- const addFlag = useCallback((newFlag) => {
26
- setFlags((oldFlags) => {
27
- if (oldFlags.findIndex((f) => f === newFlag) < 0) {
28
- return [...oldFlags, newFlag];
29
- }
30
- return [...oldFlags];
31
- });
32
- }, []);
33
- return /* @__PURE__ */ jsx(FlagsContext.Provider, {
34
- value: {
35
- flags,
36
- addFlag,
37
- clearFlags
38
- },
39
- children
40
- });
41
- }
42
- const useFlags = () => {
43
- const context = useContext(FlagsContext);
44
- if (!context)
45
- throw new Error("useFlags context must be use inside FlagsProvider");
46
- return context;
47
- };
48
- const initialState = {
49
- getLabel: () => "..",
50
- getModuleLabel: () => "No dictionary context"
51
- };
52
- const ModuleDictionaryContext = createContext(initialState);
53
- function ModuleDictionaryProvider(props) {
54
- const {
55
- children,
56
- componentsDictionary,
57
- moduleId,
58
- moduleName = "module_name",
59
- currentLang = "us",
60
- isAuth = true
61
- } = props;
62
- const {
63
- addFlag
64
- } = useFlags();
65
- const [moduleDictionary, setModuleDictionary] = useState(void 0);
66
- const {
67
- domain_token
68
- } = useEnvironment();
69
- const {
70
- startProgress,
71
- stopProgress
72
- } = useHostTools();
73
- const {
74
- networkOperation
75
- } = useNetwork();
76
- useLayoutEffect(() => {
77
- let mounted = true;
78
- startProgress();
79
- networkOperation({
80
- method: "GET",
81
- endPoint: isAuth ? `dictionaries/${moduleId}` : `na/dictionaries/${moduleId}`,
82
- parms: {
83
- comps: componentsDictionary,
84
- ...isAuth ? {} : {
85
- domain_token
86
- }
87
- }
88
- }).then((response) => {
89
- if (mounted) {
90
- setModuleDictionary({
91
- ...response
92
- });
93
- addFlag("dictionary_loaded");
94
- }
95
- }).finally(() => {
96
- stopProgress();
97
- });
98
- return function cleanUp() {
99
- mounted = false;
100
- };
101
- }, [currentLang]);
102
- const getLabel = useCallback((key) => {
103
- if (moduleDictionary === void 0)
104
- return "No dictionary";
105
- if (key === void 0)
106
- return "No key";
107
- const parts = key.split(".");
108
- if (parts.length === 2) {
109
- if (moduleDictionary[parts[0]] && moduleDictionary[parts[0]][parts[1]]) {
110
- return moduleDictionary[parts[0]][parts[1]];
111
- }
112
- } else if (parts.length === 1) {
113
- if (moduleDictionary.data && moduleDictionary.data[key]) {
114
- return moduleDictionary.data[key];
115
- }
116
- }
117
- return `No dictionary:${key}`;
118
- }, [moduleDictionary]);
119
- const getModuleLabel = useCallback(() => getLabel(moduleName), [moduleName, getLabel]);
120
- return /* @__PURE__ */ jsx(ModuleDictionaryContext.Provider, {
121
- value: {
122
- moduleDictionary,
123
- getLabel,
124
- getModuleLabel
125
- },
126
- children
127
- });
128
- }
129
- var EmitEvents = /* @__PURE__ */ ((EmitEvents2) => {
130
- EmitEvents2["EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED"] = `netsevice_unauthorized`;
131
- EmitEvents2["EMMIT_EVENT_HOST_THEME_CHANGE"] = "host_theme_change";
132
- return EmitEvents2;
133
- })(EmitEvents || {});
134
- function getPropertyByString(object, propString) {
135
- let value = object;
136
- const props = propString.split(".");
137
- for (let index = 0; index < props.length; index += 1) {
138
- if (props[index] === void 0)
139
- break;
140
- value = value[props[index]];
141
- }
142
- return value;
143
- }
144
- function getLocalStorage(key, initialValue) {
145
- try {
146
- const item = window.localStorage.getItem(key);
147
- return item !== null ? JSON.parse(item) : initialValue;
148
- } catch (e) {
149
- return initialValue;
150
- }
151
- }
152
- function setLocalStorage(key, value) {
153
- try {
154
- const item = window.localStorage.getItem(key);
155
- let newValue = item !== null ? JSON.parse(item) : {};
156
- newValue = { ...newValue, ...value };
157
- window.localStorage.setItem(key, JSON.stringify(newValue));
158
- } catch (e) {
159
- console.error(e);
160
- }
161
- }
1
+ import "react";
2
+ import "./contexts/HostToolsContext/index.js";
3
+ import "./contexts/NetworkContext/index.js";
4
+ import "./contexts/EnvironmentContext/index.js";
5
+ import "./contexts/FlagsContext/index.js";
6
+ import "./contexts/ModuleDictionaryContext/index.js";
7
+ import "./hooks/useEnvironment/index.js";
8
+ import "./hooks/useFlags/index.js";
9
+ import "./hooks/useHostTools/index.js";
10
+ import "./hooks/useLocalStorage/index.js";
11
+ import "./hooks/useNetwork/index.js";
12
+ import "./types/index.js";
13
+ import "./utils/index.js";
14
+ import "./external/axios.js";
162
15
  function getAugmentedNamespace(n) {
163
16
  if (n.__esModule)
164
17
  return n;
@@ -174,102 +27,4 @@ function getAugmentedNamespace(n) {
174
27
  });
175
28
  return a;
176
29
  }
177
- var mapObj = { exports: {} };
178
- const isObject = (value) => typeof value === "object" && value !== null;
179
- const mapObjectSkip = Symbol("skip");
180
- const isObjectCustom = (value) => isObject(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
181
- const mapObject = (object, mapper, options, isSeen = /* @__PURE__ */ new WeakMap()) => {
182
- options = {
183
- deep: false,
184
- target: {},
185
- ...options
186
- };
187
- if (isSeen.has(object)) {
188
- return isSeen.get(object);
189
- }
190
- isSeen.set(object, options.target);
191
- const { target } = options;
192
- delete options.target;
193
- const mapArray = (array) => array.map((element) => isObjectCustom(element) ? mapObject(element, mapper, options, isSeen) : element);
194
- if (Array.isArray(object)) {
195
- return mapArray(object);
196
- }
197
- for (const [key, value] of Object.entries(object)) {
198
- const mapResult = mapper(key, value, object);
199
- if (mapResult === mapObjectSkip) {
200
- continue;
201
- }
202
- let [newKey, newValue, { shouldRecurse = true } = {}] = mapResult;
203
- if (newKey === "__proto__") {
204
- continue;
205
- }
206
- if (options.deep && shouldRecurse && isObjectCustom(newValue)) {
207
- newValue = Array.isArray(newValue) ? mapArray(newValue) : mapObject(newValue, mapper, options, isSeen);
208
- }
209
- target[newKey] = newValue;
210
- }
211
- return target;
212
- };
213
- mapObj.exports = (object, mapper, options) => {
214
- if (!isObject(object)) {
215
- throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
216
- }
217
- return mapObject(object, mapper, options);
218
- };
219
- mapObj.exports.mapObjectSkip = mapObjectSkip;
220
- var __assign = function() {
221
- __assign = Object.assign || function __assign2(t) {
222
- for (var s, i = 1, n = arguments.length; i < n; i++) {
223
- s = arguments[i];
224
- for (var p in s)
225
- if (Object.prototype.hasOwnProperty.call(s, p))
226
- t[p] = s[p];
227
- }
228
- return t;
229
- };
230
- return __assign.apply(this, arguments);
231
- };
232
- function lowerCase(str) {
233
- return str.toLowerCase();
234
- }
235
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
236
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
237
- function noCase(input, options) {
238
- if (options === void 0) {
239
- options = {};
240
- }
241
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
242
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
243
- var start = 0;
244
- var end = result.length;
245
- while (result.charAt(start) === "\0")
246
- start++;
247
- while (result.charAt(end - 1) === "\0")
248
- end--;
249
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
250
- }
251
- function replace(input, re, value) {
252
- if (re instanceof RegExp)
253
- return input.replace(re, value);
254
- return re.reduce(function(input2, re2) {
255
- return input2.replace(re2, value);
256
- }, input);
257
- }
258
- function dotCase(input, options) {
259
- if (options === void 0) {
260
- options = {};
261
- }
262
- return noCase(input, __assign({ delimiter: "." }, options));
263
- }
264
- function snakeCase(input, options) {
265
- if (options === void 0) {
266
- options = {};
267
- }
268
- return dotCase(input, __assign({ delimiter: "_" }, options));
269
- }
270
- const dist_es2015 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
271
- __proto__: null,
272
- snakeCase
273
- }, Symbol.toStringTag, { value: "Module" }));
274
- const require$$1 = /* @__PURE__ */ getAugmentedNamespace(dist_es2015);
275
- export { EmitEvents as E, FlagsContext as F, ModuleDictionaryContext as M, FlagsProvider as a, ModuleDictionaryProvider as b, getLocalStorage as c, getPropertyByString as g, mapObj as m, require$$1 as r, setLocalStorage as s, useFlags as u };
30
+ export { getAugmentedNamespace as g };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
3
  "private": false,
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
5
5
  "license": "UNLICENSED",
6
6
  "author": "M4L Team",
7
7
  "scripts": {
@@ -1,3 +0,0 @@
1
- function voidFunction() {
2
- }
3
- export { voidFunction as v };