@fto-consult/expo-ui 7.4.62 → 7.4.63

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/electron/index.js CHANGED
@@ -127,7 +127,7 @@ function createBrowserWindow (options){
127
127
  if(showOnLoad){
128
128
  _win.once('ready-to-show', () => {
129
129
  _win.show();
130
- ipcMain.send("window-ready-to-show",JSON.stringify(options.readyToShowOptions));
130
+ _win.webContents.send("window-ready-to-show",JSON.stringify(options.readyToShowOptions));
131
131
  if(options.devTools){
132
132
  _win.webContents.openDevTools();
133
133
  }
@@ -11,6 +11,7 @@ module.exports = {
11
11
  console.error(...args);
12
12
  process.exit(-1);
13
13
  },
14
+ json : require("./json"),
14
15
  replaceAll : require("./replaceAll"),
15
16
  isBase64 : require("./isBase64"),
16
17
  isDataURL : require("./isDataURL"),
@@ -0,0 +1,57 @@
1
+ // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+
6
+ module.exports.decycle = function decycle(obj, stack = []) {
7
+ if(typeof obj ==='function') return undefined;
8
+ if (!obj || typeof obj !== 'object')
9
+ return obj;
10
+
11
+ if (stack.includes(obj))
12
+ return null;
13
+
14
+ let s = stack.concat([obj]);
15
+ return Array.isArray(obj)
16
+ ? obj.map(x => decycle(x, s))
17
+ : Object.fromEntries(
18
+ Object.entries(obj)
19
+ .map(([k, v]) => [k, decycle(v, s)]));
20
+ }
21
+
22
+ module.exports.stringify = function(jsonObj,decylcleVal){
23
+ return isJSON(jsonObj) ? jsonObj : JSON.stringify(decylcleVal !== false ? decycle(jsonObj) : jsonObj);
24
+ }
25
+
26
+ module.exports.isJSON = function (json_string){
27
+ if(!json_string || typeof json_string != 'string') return false;
28
+ var text = json_string;
29
+ return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, '')));
30
+ }
31
+
32
+ /***
33
+ * parse JSON string recursively
34
+ * @param {string} json string to parse
35
+ * @return {object} or null, parse json
36
+ */
37
+ module.exports. parseJSON = function(jsonStr){
38
+ if(!isJSON(jsonStr)) {
39
+ if(jsonStr && typeof(jsonStr) == 'object'){
40
+ for(var i in jsonStr){
41
+ jsonStr[i] = parseJSON(jsonStr[i]);
42
+ }
43
+ }
44
+ return jsonStr;
45
+ }
46
+ try {
47
+ jsonStr = JSON.parse(jsonStr);
48
+ if(jsonStr && typeof(jsonStr) == 'object'){
49
+ for(var i in jsonStr){
50
+ jsonStr[i] = parseJSON(jsonStr[i]);
51
+ }
52
+ }
53
+ } catch(e){
54
+ return jsonStr;
55
+ }
56
+ return jsonStr;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.4.62",
3
+ "version": "7.4.63",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",