File tree Expand file tree Collapse file tree 1 file changed +2
-24
lines changed Expand file tree Collapse file tree 1 file changed +2
-24
lines changed Original file line number Diff line number Diff line change 1
- /**
2
- * @template T
3
- * @param {T } fn
4
- * @returns {T }
5
- */
6
- function memoize ( fn ) {
7
- const cache = new Map ( ) ;
8
- return ( arg ) => {
9
- let res = cache . get ( arg ) ;
10
- if ( ! res ) {
11
- res = fn ( arg ) ;
12
- cache . set ( arg , res ) ;
13
- }
14
- return res ;
15
- } ;
16
- }
17
-
18
1
// DOM properties that should NOT have "px" added when numeric
19
2
export const IS_NON_DIMENSIONAL = / a c i t | e x (?: s | g | n | p | $ ) | r p h | g r i d | o w s | m n c | n t w | i n e [ c h ] | z o o | ^ o r d | ^ - - / i;
20
3
@@ -26,15 +9,10 @@ const tagsToReplace = {
26
9
'"' : '"'
27
10
} ;
28
11
const replaceTag = ( tag ) => tagsToReplace [ tag ] || tag ;
29
-
30
- /**
31
- * @param {any } s
32
- * @returns {string }
33
- */
34
- export const encodeEntities = memoize ( ( s ) => {
12
+ export function encodeEntities ( s ) {
35
13
if ( typeof s !== 'string' ) s = String ( s ) ;
36
14
return s . replace ( HTML_ENTITY_REG , replaceTag ) ;
37
- } ) ;
15
+ }
38
16
39
17
export let indent = ( s , char ) =>
40
18
String ( s ) . replace ( / ( \n + ) / g, '$1' + ( char || '\t' ) ) ;
You can’t perform that action at this time.
0 commit comments