diginext-utils 2.0.38 → 2.0.40

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 @@
1
+ export default function getTextBetweenCharByIndex(str: string, char: any, index: Number): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const indexesOf_1 = __importDefault(require("string/indexesOf"));
7
+ function getTextBetweenCharByIndex(str, char, index) {
8
+ const arr = (0, indexesOf_1.default)(str, char);
9
+ let start = 0, end = 0;
10
+ for (let i = 0; i < arr.length; i++) {
11
+ const _index = arr[i];
12
+ if (index > _index) {
13
+ start = _index;
14
+ end = arr[i + 1];
15
+ }
16
+ }
17
+ const result = str.substring(start + 1, end);
18
+ return result;
19
+ }
20
+ exports.default = getTextBetweenCharByIndex;
21
+ //# sourceMappingURL=getTextBetweenCharByIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTextBetweenCharByIndex.js","sourceRoot":"","sources":["../../src/string/getTextBetweenCharByIndex.ts"],"names":[],"mappings":";;;;;AAAA,iEAAyC;AAEzC,SAAwB,yBAAyB,CAAC,GAAW,EAAE,IAAS,EAAE,KAAa;IACtF,MAAM,GAAG,GAAG,IAAA,mBAAS,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEjC,IAAI,KAAK,GAAG,CAAC,EACZ,GAAG,GAAG,CAAC,CAAC;IAET,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAEtB,IAAI,KAAK,GAAG,MAAM,EAAE;YACnB,KAAK,GAAG,MAAM,CAAC;YACf,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACjB;KACD;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC;AACf,CAAC;AAjBD,4CAiBC"}
@@ -0,0 +1 @@
1
+ export default function getTextBetweenCharByIndex(str: string, char: any, index: Number): string;
@@ -0,0 +1,15 @@
1
+ import indexesOf from "string/indexesOf";
2
+ export default function getTextBetweenCharByIndex(str, char, index) {
3
+ const arr = indexesOf(str, char);
4
+ let start = 0, end = 0;
5
+ for (let i = 0; i < arr.length; i++) {
6
+ const _index = arr[i];
7
+ if (index > _index) {
8
+ start = _index;
9
+ end = arr[i + 1];
10
+ }
11
+ }
12
+ const result = str.substring(start + 1, end);
13
+ return result;
14
+ }
15
+ //# sourceMappingURL=getTextBetweenCharByIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTextBetweenCharByIndex.js","sourceRoot":"","sources":["../../src/string/getTextBetweenCharByIndex.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,GAAW,EAAE,IAAS,EAAE,KAAa;IACtF,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEjC,IAAI,KAAK,GAAG,CAAC,EACZ,GAAG,GAAG,CAAC,CAAC;IAET,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAEtB,IAAI,KAAK,GAAG,MAAM,EAAE;YACnB,KAAK,GAAG,MAAM,CAAC;YACf,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACjB;KACD;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginext-utils",
3
- "version": "2.0.38",
3
+ "version": "2.0.40",
4
4
  "sideEffects": false,
5
5
  "readme": "README.md",
6
6
  "homepage": "https://wearetopgroup.com",
@@ -0,0 +1,20 @@
1
+ import indexesOf from "string/indexesOf";
2
+
3
+ export default function getTextBetweenCharByIndex(str: string, char: any, index: Number) {
4
+ const arr = indexesOf(str, char);
5
+
6
+ let start = 0,
7
+ end = 0;
8
+
9
+ for (let i = 0; i < arr.length; i++) {
10
+ const _index = arr[i];
11
+
12
+ if (index > _index) {
13
+ start = _index;
14
+ end = arr[i + 1];
15
+ }
16
+ }
17
+
18
+ const result = str.substring(start + 1, end);
19
+ return result;
20
+ }
@@ -12,4 +12,4 @@ export default function indexesOf(str: string, regex: any) {
12
12
  }
13
13
 
14
14
  return list;
15
- }
15
+ }
package/src/string/url.ts CHANGED
@@ -69,15 +69,13 @@ export const getFileNameWithoutExtension = (url: string) => {
69
69
  return "";
70
70
  };
71
71
 
72
- export const getFileNameWithExtension = (url: string) => {
72
+ export const getFileNameWithExtension = (url: string): string => {
73
73
  const _url = decodeURIComponent(url);
74
74
 
75
- const m = _url.toString().match(/.*\/(.*)$/) || [];
75
+ const m = `${_url.toString().match(/.*\/(.*)$/)}` as string;
76
76
 
77
- if (typeof m != "undefined" && m?.length > 1) {
78
- const a = m?.[1].split("/")?.pop() || "";
79
- const b = a.split("?")?.shift();
80
- return b || m?.[1] || "";
77
+ if (m && m.length > 1) {
78
+ return m[1].split("/").pop()?.split("?")[0] || "";
81
79
  }
82
80
 
83
81
  if (!isNull(_url)) return url;