File tree Expand file tree Collapse file tree 10 files changed +98
-2
lines changed
test/form/samples/index-key Expand file tree Collapse file tree 10 files changed +98
-2
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,15 @@ export function makeLegal(value: string): string {
25
25
}
26
26
27
27
export const VALID_IDENTIFIER_REGEXP = / ^ [ $ _ \p{ ID_Start} ] [ $ \u200C \u200D \p{ ID_Continue} ] * $ / u;
28
- export const NUMBER_REGEXP = / ^ \d + $ / ;
28
+ const NUMBER_REGEXP = / ^ (?: 0 | [ 1 - 9 ] \d * ) $ / ;
29
29
30
30
export function stringifyObjectKeyIfNeeded ( key : string ) {
31
- if ( VALID_IDENTIFIER_REGEXP . test ( key ) || NUMBER_REGEXP . test ( key ) ) {
31
+ if ( VALID_IDENTIFIER_REGEXP . test ( key ) ) {
32
32
return key === '__proto__' ? '["__proto__"]' : key ;
33
33
}
34
+ if ( NUMBER_REGEXP . test ( key ) && + key <= Number . MAX_SAFE_INTEGER ) {
35
+ return key ;
36
+ }
34
37
return JSON . stringify ( key ) ;
35
38
}
36
39
Original file line number Diff line number Diff line change
1
+ module . exports = defineTest ( {
2
+ description : 'index key' ,
3
+ options : {
4
+ external : [ 'x' ] ,
5
+ output : {
6
+ globals : {
7
+ x : 'x'
8
+ }
9
+ }
10
+ }
11
+ } ) ;
Original file line number Diff line number Diff line change
1
+ define ( [ 'x' ] , ( function ( x$1 ) { 'use strict' ;
2
+
3
+ var x = /*#__PURE__*/ Object . freeze ( {
4
+ __proto__ : null ,
5
+ "00" : x$1 [ "00" ] ,
6
+ "9007199254740993" : x$1 [ "9007199254740993" ]
7
+ } ) ;
8
+
9
+ console . log ( x ) ;
10
+
11
+ } ) ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var x$1 = require ( 'x' ) ;
4
+
5
+ var x = /*#__PURE__*/ Object . freeze ( {
6
+ __proto__ : null ,
7
+ "00" : x$1 [ "00" ] ,
8
+ "9007199254740993" : x$1 [ "9007199254740993" ]
9
+ } ) ;
10
+
11
+ console . log ( x ) ;
Original file line number Diff line number Diff line change
1
+ import { "00" as _00 , "9007199254740993" as _9007199254740993 } from 'x' ;
2
+
3
+ var x = /*#__PURE__*/ Object . freeze ( {
4
+ __proto__ : null ,
5
+ "00" : _00 ,
6
+ "9007199254740993" : _9007199254740993
7
+ } ) ;
8
+
9
+ console . log ( x ) ;
Original file line number Diff line number Diff line change
1
+ ( function ( x$1 ) {
2
+ 'use strict' ;
3
+
4
+ var x = /*#__PURE__*/ Object . freeze ( {
5
+ __proto__ : null ,
6
+ "00" : x$1 [ "00" ] ,
7
+ "9007199254740993" : x$1 [ "9007199254740993" ]
8
+ } ) ;
9
+
10
+ console . log ( x ) ;
11
+
12
+ } ) ( x ) ;
Original file line number Diff line number Diff line change
1
+ System . register ( [ 'x' ] , ( function ( ) {
2
+ 'use strict' ;
3
+ var _00 , _9007199254740993 ;
4
+ return {
5
+ setters : [ function ( module ) {
6
+ _00 = module [ "00" ] ;
7
+ _9007199254740993 = module [ "9007199254740993" ] ;
8
+ } ] ,
9
+ execute : ( function ( ) {
10
+
11
+ var x = /*#__PURE__*/ Object . freeze ( {
12
+ __proto__ : null ,
13
+ "00" : _00 ,
14
+ "9007199254740993" : _9007199254740993
15
+ } ) ;
16
+
17
+ console . log ( x ) ;
18
+
19
+ } )
20
+ } ;
21
+ } ) ) ;
Original file line number Diff line number Diff line change
1
+ ( function ( global , factory ) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory ( require ( 'x' ) ) :
3
+ typeof define === 'function' && define . amd ? define ( [ 'x' ] , factory ) :
4
+ ( global = typeof globalThis !== 'undefined' ? globalThis : global || self , factory ( global . x ) ) ;
5
+ } ) ( this , ( function ( x$1 ) { 'use strict' ;
6
+
7
+ var x = /*#__PURE__*/ Object . freeze ( {
8
+ __proto__ : null ,
9
+ "00" : x$1 [ "00" ] ,
10
+ "9007199254740993" : x$1 [ "9007199254740993" ]
11
+ } ) ;
12
+
13
+ console . log ( x ) ;
14
+
15
+ } ) ) ;
Original file line number Diff line number Diff line change
1
+ import * as x from './x' ;
2
+ console . log ( x ) ;
Original file line number Diff line number Diff line change
1
+ export { '00' , '9007199254740993' } from 'x' ;
You can’t perform that action at this time.
0 commit comments