moderndash 0.0.10 → 0.0.12
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/package.json +2 -2
- package/src/array/difference.ts +2 -2
- package/src/array/differenceBy.ts +1 -1
- package/src/array/index.ts +0 -3
- package/src/array/intersectionBy.ts +1 -1
- package/src/array/shuffle.ts +1 -1
- package/src/array/uniqWith.ts +1 -1
- package/src/collection/countBy.ts +4 -4
- package/src/collection/groupBy.ts +3 -3
- package/src/function/after.ts +10 -4
- package/src/function/before.ts +8 -4
- package/src/function/debounce.ts +12 -11
- package/src/function/index.ts +1 -0
- package/src/function/memoize.ts +7 -3
- package/src/function/once.ts +6 -3
- package/src/function/throttle.ts +5 -3
- package/src/lang/isEmpty.ts +33 -5
- package/src/lang/isEqual.ts +26 -0
- package/src/lang/isEqualWith.ts +30 -1
- package/src/object/pick.ts +4 -5
- package/src/string/camelCase.ts +15 -0
- package/src/string/capitalize.ts +11 -0
- package/src/string/deburr.ts +15 -0
- package/src/string/escape.ts +11 -0
- package/src/string/escapeRegExp.ts +12 -0
- package/src/string/kebabCase.ts +15 -0
- package/src/string/pascalCase.ts +16 -0
- package/src/string/snakeCase.ts +17 -0
- package/src/string/startCase.ts +15 -0
- package/src/string/stripSpecialChars.ts +11 -0
- package/src/string/unescape.ts +14 -2
- package/src/types.ts +9 -3
- package/LICENSE +0 -21
- package/README.md +0 -92
- package/dist/index.cjs +0 -733
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -585
- package/dist/index.js +0 -658
- package/dist/index.js.map +0 -1
- package/src/array/union.ts +0 -16
- package/src/array/unionBy.ts +0 -26
- package/src/array/unionWith.ts +0 -31
package/src/string/unescape.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Converts the HTML entities `&`, `<`, `>`, `"` and `'`
|
|
3
|
+
* in a string to their corresponding characters.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* unescape('fred, barney, & pebbles')
|
|
7
|
+
* // => 'fred, barney, & pebbles'
|
|
8
|
+
* @category String
|
|
9
|
+
* @param str - The string to unescape.
|
|
10
|
+
* @returns Returns the unescaped string.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export function unescape(str: string): string {
|
|
2
14
|
const entityMap: Record<string, string> = {
|
|
3
15
|
'&': '&',
|
|
4
16
|
'<': '<',
|
|
@@ -6,5 +18,5 @@ export function unescapeHTML(html: string): string {
|
|
|
6
18
|
'"': '"',
|
|
7
19
|
''': '\''
|
|
8
20
|
};
|
|
9
|
-
return
|
|
21
|
+
return str.replace(/&(?:amp|lt|gt|quot|#(0+)?39);/g, (entity: string) => entityMap[entity] || entity);
|
|
10
22
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
export type MinimumTwoArrays<
|
|
1
|
+
export type MinimumTwoArrays<TInput> = [TInput[], TInput[], ...TInput[][]];
|
|
2
2
|
|
|
3
3
|
export type IterateeFunction<T> = (value: T) => unknown;
|
|
4
4
|
export type PropertyShorthand<T> = keyof T;
|
|
5
5
|
|
|
6
6
|
export type RecordKey = string | number | symbol;
|
|
7
|
+
export type ArrayOrRecord<TInput> = TInput[] | Record<RecordKey, TInput>;
|
|
7
8
|
|
|
8
|
-
export type
|
|
9
|
-
|
|
9
|
+
export type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @description Generic function type, should fit any function
|
|
13
|
+
* @typeParam TFunc - The input function type
|
|
14
|
+
*/
|
|
15
|
+
export type GenericFunction<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>> = (...args: Parameters<TFunc>) => ReturnType<TFunc>;
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Maximilian Dewald
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
<p align=center>
|
|
4
|
-
A Typescript-First utility library inspired by Lodash.
|
|
5
|
-
Optimized for modern browsers.
|
|
6
|
-
</p>
|
|
7
|
-
<p align=center>
|
|
8
|
-
✅ ESM
|
|
9
|
-
✅ Tree-shakable
|
|
10
|
-
✅ Typescript Strict Mode (no any types)
|
|
11
|
-
✅ Zero dependencies
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
-------
|
|
15
|
-
|
|
16
|
-
> **Warning**
|
|
17
|
-
> This library is still in development and is not ready for production use.
|
|
18
|
-
|
|
19
|
-
## Documentation
|
|
20
|
-
The documentation is WIP.
|
|
21
|
-
|
|
22
|
-
## Removed Functions because of trivial native alternatives
|
|
23
|
-
Look at [You-Dont-Need-Lodash](https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore) for native replacements.
|
|
24
|
-
|
|
25
|
-
### Array Functions
|
|
26
|
-
- compact
|
|
27
|
-
- concat
|
|
28
|
-
- differenceBy property shorthand
|
|
29
|
-
- drop
|
|
30
|
-
- dropRight
|
|
31
|
-
- fill
|
|
32
|
-
- findIndex
|
|
33
|
-
- findLastIndex
|
|
34
|
-
- first/head
|
|
35
|
-
- flatten
|
|
36
|
-
- flattenDeep
|
|
37
|
-
- flattenDepth
|
|
38
|
-
- fromPairs
|
|
39
|
-
- initial
|
|
40
|
-
- join
|
|
41
|
-
- last
|
|
42
|
-
- lastIndexOf
|
|
43
|
-
- nth
|
|
44
|
-
- without
|
|
45
|
-
- reverse
|
|
46
|
-
- slice
|
|
47
|
-
- sortedIndexOf
|
|
48
|
-
- tail
|
|
49
|
-
- take
|
|
50
|
-
- takeRight
|
|
51
|
-
- without
|
|
52
|
-
|
|
53
|
-
### Collection Functions
|
|
54
|
-
- each/forEach
|
|
55
|
-
- every
|
|
56
|
-
- filter
|
|
57
|
-
- find
|
|
58
|
-
- flatMap
|
|
59
|
-
- includes
|
|
60
|
-
|
|
61
|
-
### String Functions
|
|
62
|
-
- lowerCase
|
|
63
|
-
- trim
|
|
64
|
-
- trimEnd
|
|
65
|
-
- trimStart
|
|
66
|
-
- pad
|
|
67
|
-
- padEnd
|
|
68
|
-
- padStart
|
|
69
|
-
|
|
70
|
-
Functions are not considered trivial if they:
|
|
71
|
-
- include reduce methods
|
|
72
|
-
- include multiple nested function calls
|
|
73
|
-
|
|
74
|
-
## TODO
|
|
75
|
-
- More unzip tests
|
|
76
|
-
- Check if flatmapdeep, flatmapDepth is included in native flatmap
|
|
77
|
-
- GroupBy Property Shorthand
|
|
78
|
-
|
|
79
|
-
## Might be added later (open for discussion)
|
|
80
|
-
- pull functions (pull, pullAll, pullAllBy, pullAllWith, pullAt)
|
|
81
|
-
- remove
|
|
82
|
-
- sorted functions (sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy)
|
|
83
|
-
- if performance is better than native alternatives (testing needed)
|
|
84
|
-
- xor functions (xor, xorBy, xorWith)
|
|
85
|
-
- zipObject, zipObjectDeep
|
|
86
|
-
- forEachRight
|
|
87
|
-
- findLast
|
|
88
|
-
- lowerFirst
|
|
89
|
-
- keyBy
|
|
90
|
-
|
|
91
|
-
## Continue at
|
|
92
|
-
- invokeMap
|