moderndash 3.12.0 → 4.0.1

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
@@ -1,4 +1,4 @@
1
- ![ModernDash Logo](https://raw.githubusercontent.com/Maggi64/moderndash/main/website/src/assets/moderndashLogo.svg)
1
+ ![ModernDash Logo](https://raw.githubusercontent.com/maxdewald/moderndash/main/website/src/assets/moderndashLogo.svg)
2
2
 
3
3
  <p align=center>
4
4
  <b>
@@ -14,9 +14,8 @@
14
14
  ✅ Typescript Strict Mode (no any)
15
15
  <br>
16
16
  ✅ 100% Test Coverage
17
- ✅ Zero dependencies
17
+ ✅ Zero runtime dependencies
18
18
  ✅ Hoverable Docs
19
- ✅ TS Decorators
20
19
  </div>
21
20
  <p></p>
22
21
 
@@ -33,8 +32,8 @@
33
32
  <span>
34
33
  <img alt="node-current" src="https://img.shields.io/node/v/moderndash?color=blue">
35
34
  </span>
36
- <a href="https://github.com/Maggi64/moderndash/blob/main/LICENSE">
37
- <img alt="GitHub" src="https://img.shields.io/github/license/maggi64/moderndash?color=orange">
35
+ <a href="https://github.com/maxdewald/moderndash/blob/main/LICENSE">
36
+ <img alt="GitHub" src="https://img.shields.io/github/license/maxdewald/moderndash?color=orange">
38
37
  </a>
39
38
  </div>
40
39
 
@@ -47,7 +46,7 @@
47
46
  ---
48
47
 
49
48
  <div align=center class="space-y">
50
- <img alt="Intro Code" width=100% src="https://raw.githubusercontent.com/Maggi64/moderndash/main/website/src/assets/introCodeV6.svg"></img>
49
+ <img alt="Intro Code" width=100% src="https://raw.githubusercontent.com/maxdewald/moderndash/main/website/src/assets/introCodeV6.svg"></img>
51
50
  </div>
52
51
 
53
52
  ## 💾 Installation
@@ -57,18 +56,13 @@ npm install moderndash
57
56
  ```
58
57
  ## 📋 Requirements
59
58
 
60
- **NodeJS**: >=16.15 | **Typescript**: >=4.8
61
-
62
- > `NodeJS 16-18`: Enable the [experimental-global-webcrypto](https://nodejs.dev/en/api/v16/cli#--experimental-global-webcrypto) flag to use crypto functions.
63
- *Works out of the box with NodeJS 19+*
64
-
65
- > `TypeScript`: Enable the [experimentalDecorators](https://www.typescriptlang.org/tsconfig#experimentalDecorators) flag to use decorator functions.
59
+ **NodeJS**: >=20.x | **Typescript**: >=5.0
66
60
 
67
61
  ## 🚀 Performance
68
62
 
69
63
  ModernDash aims to outperform Lodash and deliver lightning-fast utility functions. Performance is not an afterthought, but a top priority. You can expect ModernDash to exceed or at least match the performance of Lodash in most benchmarks, ensuring that your project stays speedy and efficient.
70
64
 
71
- **[[ Benchmark Results](https://github.com/Maggi64/moderndash/blob/main/benchmark/RESULTS.md) ]**
65
+ **[[ Benchmark Results](https://github.com/maxdewald/moderndash/blob/main/benchmark/RESULTS.md) ]**
72
66
 
73
67
  ## 🗃 FAQ
74
68
 
@@ -77,11 +71,6 @@ ModernDash does not include any lodash functions that can be easily replaced by
77
71
  Please refer to [You-Dont-Need-Lodash](https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore) or [youmightnotneed.com/lodash](https://youmightnotneed.com/lodash) for native replacements.
78
72
  If you still believe a function is missing, please open an issue.
79
73
 
80
- ### Why no pipe utility functions?
81
- The upcoming [pipe operator](https://github.com/tc39/proposal-pipeline-operator) in JavaScript will provide function composition, so the framework focuses on providing other useful utility functions that are not yet available.
82
-
83
- The pipe operator can already be included via [babel](https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator).
84
-
85
74
  ## 💌 Love & Thanks
86
75
 
87
76
  To [type-fest](https://github.com/sindresorhus/type-fest) for providing some valuable types.
@@ -90,4 +79,4 @@ To [type-fest](https://github.com/sindresorhus/type-fest) for providing some val
90
79
 
91
80
  - Star the repo if you like it
92
81
 
93
- - Check the [contributing](https://github.com/Maggi64/moderndash/blob/main/CONTRIBUTING.md) section!
82
+ - Check the [contributing](https://github.com/maxdewald/moderndash/blob/main/CONTRIBUTING.md) section!
package/dist/index.cjs CHANGED
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  Queue: () => Queue,
24
24
  average: () => average,
25
25
  camelCase: () => camelCase,
@@ -87,7 +87,7 @@ __export(src_exports, {
87
87
  unescapeHtml: () => unescapeHtml,
88
88
  unique: () => unique
89
89
  });
90
- module.exports = __toCommonJS(src_exports);
90
+ module.exports = __toCommonJS(index_exports);
91
91
 
92
92
  // src/array/chunk.ts
93
93
  function chunk(array, chunkSize) {
@@ -317,12 +317,10 @@ function randomInt(min, max) {
317
317
  // src/crypto/randomElem.ts
318
318
  function randomElem(array, multi) {
319
319
  if (multi === void 0) {
320
- if (array.length === 0)
321
- return void 0;
320
+ if (array.length === 0) return void 0;
322
321
  return getSingleElement(array);
323
322
  }
324
- if (multi && array.length === 0)
325
- return [];
323
+ if (multi && array.length === 0) return [];
326
324
  const result = new Array(multi);
327
325
  for (let i = 0; i < multi; i++) {
328
326
  result[i] = getSingleElement(array);
@@ -348,8 +346,7 @@ function randomFloat(min, max) {
348
346
  // src/crypto/randomString.ts
349
347
  var DEFAULT_CHARSET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
350
348
  function randomString(length, charSet = DEFAULT_CHARSET) {
351
- if (charSet.length <= 0)
352
- return "";
349
+ if (charSet.length <= 0) return "";
353
350
  let result = "";
354
351
  for (let index = 0; index < length; index++) {
355
352
  const randomIndex = randomInt(0, charSet.length - 1);
@@ -361,9 +358,9 @@ function randomString(length, charSet = DEFAULT_CHARSET) {
361
358
  // src/decorator/toDecorator.ts
362
359
  function toDecorator(func) {
363
360
  return function(...args) {
364
- return function(_target, _key, descriptor) {
365
- const creatorArgs = [descriptor.value, ...args];
366
- descriptor.value = func(...creatorArgs);
361
+ return function(originalMethod, _context) {
362
+ const funcArgs = [originalMethod, ...args];
363
+ return func(...funcArgs);
367
364
  };
368
365
  };
369
366
  }
@@ -548,6 +545,7 @@ function merge(target, ...sources) {
548
545
  const targetCopy = { ...target };
549
546
  for (const source of sources) {
550
547
  for (const [key, value] of Object.entries(source)) {
548
+ if (key === "__proto__") continue;
551
549
  targetCopy[key] = isPlainObject(value) && isPlainObject(targetCopy[key]) ? merge(targetCopy[key], value) : value;
552
550
  }
553
551
  }
@@ -581,6 +579,8 @@ function set(obj, path, value) {
581
579
  let currentObj = obj;
582
580
  for (let index = 0; index < pathParts.length; index++) {
583
581
  const key = pathParts[index].replace(matchBracketsRegex, "");
582
+ if (key === "__proto__")
583
+ return obj;
584
584
  if (index === pathParts.length - 1) {
585
585
  currentObj[key] = value;
586
586
  break;
@@ -773,8 +773,7 @@ function splitWords(str) {
773
773
 
774
774
  // src/string/capitalize.ts
775
775
  function capitalize(str) {
776
- if (str === "")
777
- return "";
776
+ if (str === "") return "";
778
777
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
779
778
  }
780
779
 
@@ -786,12 +785,10 @@ function deburr(str) {
786
785
 
787
786
  // src/string/camelCase.ts
788
787
  function camelCase(str) {
789
- if (str === "")
790
- return "";
788
+ if (str === "") return "";
791
789
  str = deburr(str);
792
790
  const words = splitWords(str);
793
- if (words.length === 0)
794
- return "";
791
+ if (words.length === 0) return "";
795
792
  let camelCase2 = words[0].toLowerCase();
796
793
  for (let index = 1; index < words.length; index++) {
797
794
  const word = words[index];
@@ -821,8 +818,7 @@ function escapeRegExp(str) {
821
818
 
822
819
  // src/string/kebabCase.ts
823
820
  function kebabCase(str) {
824
- if (str === "")
825
- return "";
821
+ if (str === "") return "";
826
822
  str = deburr(str);
827
823
  const words = splitWords(str);
828
824
  let kebabCase2 = "";
@@ -834,8 +830,7 @@ function kebabCase(str) {
834
830
 
835
831
  // src/string/pascalCase.ts
836
832
  function pascalCase(str) {
837
- if (str === "")
838
- return "";
833
+ if (str === "") return "";
839
834
  str = deburr(str);
840
835
  const words = splitWords(str);
841
836
  let pascalCase2 = "";
@@ -855,8 +850,7 @@ function replaceLast(str, searchFor, replaceWith) {
855
850
 
856
851
  // src/string/snakeCase.ts
857
852
  function snakeCase(str) {
858
- if (str === "")
859
- return "";
853
+ if (str === "") return "";
860
854
  str = deburr(str);
861
855
  const words = splitWords(str);
862
856
  let snakeCase2 = "";
@@ -871,8 +865,7 @@ function snakeCase(str) {
871
865
 
872
866
  // src/string/titleCase.ts
873
867
  function titleCase(str) {
874
- if (str === "")
875
- return "";
868
+ if (str === "") return "";
876
869
  str = deburr(str);
877
870
  const words = splitWords(str);
878
871
  let titleCase2 = "";
@@ -916,8 +909,7 @@ function trimStart(str, chars) {
916
909
  // src/string/truncate.ts
917
910
  function truncate(str, options) {
918
911
  const { length = 30, ellipsis = "...", separator } = options ?? {};
919
- if (str.length <= length)
920
- return str;
912
+ if (str.length <= length) return str;
921
913
  const end = length - ellipsis.length;
922
914
  if (end < 1)
923
915
  return ellipsis;
@@ -961,10 +953,8 @@ function isEmpty(value) {
961
953
 
962
954
  // src/validate/isEqual.ts
963
955
  function isEqual(a, b) {
964
- if (Object.is(a, b))
965
- return true;
966
- if (typeof a !== typeof b)
967
- return false;
956
+ if (Object.is(a, b)) return true;
957
+ if (typeof a !== typeof b) return false;
968
958
  if (Array.isArray(a) && Array.isArray(b))
969
959
  return isSameArray(a, b);
970
960
  if (a instanceof Date && b instanceof Date)
@@ -978,8 +968,7 @@ function isEqual(a, b) {
978
968
  if (a instanceof DataView && b instanceof DataView)
979
969
  return dataViewsAreEqual(a, b);
980
970
  if (isTypedArray(a) && isTypedArray(b)) {
981
- if (a.byteLength !== b.byteLength)
982
- return false;
971
+ if (a.byteLength !== b.byteLength) return false;
983
972
  return isSameArray(a, b);
984
973
  }
985
974
  return false;
@@ -987,25 +976,20 @@ function isEqual(a, b) {
987
976
  function isSameObject(a, b) {
988
977
  const keys1 = Object.keys(a);
989
978
  const keys2 = Object.keys(b);
990
- if (!isEqual(keys1, keys2))
991
- return false;
979
+ if (!isEqual(keys1, keys2)) return false;
992
980
  for (const key of keys1) {
993
- if (!isEqual(a[key], b[key]))
994
- return false;
981
+ if (!isEqual(a[key], b[key])) return false;
995
982
  }
996
983
  return true;
997
984
  }
998
985
  function isSameArray(a, b) {
999
- if (a.length !== b.length)
1000
- return false;
986
+ if (a.length !== b.length) return false;
1001
987
  return a.every((element, index) => isEqual(element, b[index]));
1002
988
  }
1003
989
  function dataViewsAreEqual(a, b) {
1004
- if (a.byteLength !== b.byteLength)
1005
- return false;
990
+ if (a.byteLength !== b.byteLength) return false;
1006
991
  for (let offset = 0; offset < a.byteLength; offset++) {
1007
- if (a.getUint8(offset) !== b.getUint8(offset))
1008
- return false;
992
+ if (a.getUint8(offset) !== b.getUint8(offset)) return false;
1009
993
  }
1010
994
  return true;
1011
995
  }