File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/transforms/v2-to-v3/apis Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
- import type { ObjectExpression , ObjectProperty , Property } from "jscodeshift" ;
2
-
3
- import { OBJECT_PROPERTY_TYPE_LIST } from "../config" ;
1
+ import type { ObjectExpression } from "jscodeshift" ;
4
2
5
3
export const getWaiterConfigValue = ( waiterConfiguration : ObjectExpression , key : string ) => {
6
4
for ( const property of waiterConfiguration . properties ) {
7
- if ( ! OBJECT_PROPERTY_TYPE_LIST . includes ( property . type ) ) {
5
+ if ( property . type !== "Property" && property . type !== "ObjectProperty" ) {
8
6
continue ;
9
7
}
10
- const propertyKey = ( property as Property | ObjectProperty ) . key ;
11
- const propertyValue = ( property as Property | ObjectProperty ) . value ;
12
- if ( propertyKey . type !== "Identifier" ) {
8
+ if ( property . key . type !== "Identifier" ) {
13
9
continue ;
14
10
}
15
- if ( propertyKey . name === key ) {
11
+ if ( property . key . name === key ) {
12
+ const propertyValue = property . value ;
16
13
if ( propertyValue . type === "Literal" || propertyValue . type === "StringLiteral" ) {
17
14
if ( typeof propertyValue . value === "number" ) {
18
15
return propertyValue . value . toString ( ) ;
You can’t perform that action at this time.
0 commit comments