Skip to content

Commit cff408c

Browse files
committed
chore: Refactor ts code
1 parent 1fc3d03 commit cff408c

7 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/react-native-executorch/src/modules/computer_vision/ClassificationModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ClassificationModule extends BaseModule {
2828
model.modelSource
2929
);
3030

31-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
31+
if (!paths?.[0]) {
3232
throw new RnExecutorchError(
3333
RnExecutorchErrorCode.DownloadInterrupted,
3434
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

packages/react-native-executorch/src/modules/computer_vision/ImageEmbeddingsModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ImageEmbeddingsModule extends BaseModule {
2727
model.modelSource
2828
);
2929

30-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
30+
if (!paths?.[0]) {
3131
throw new RnExecutorchError(
3232
RnExecutorchErrorCode.DownloadInterrupted,
3333
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

packages/react-native-executorch/src/modules/computer_vision/ImageSegmentationModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ImageSegmentationModule extends BaseModule {
2929
model.modelSource
3030
);
3131

32-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
32+
if (!paths?.[0]) {
3333
throw new RnExecutorchError(
3434
RnExecutorchErrorCode.DownloadInterrupted,
3535
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ObjectDetectionModule extends BaseModule {
2929
model.modelSource
3030
);
3131

32-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
32+
if (!paths?.[0]) {
3333
throw new RnExecutorchError(
3434
RnExecutorchErrorCode.DownloadInterrupted,
3535
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

packages/react-native-executorch/src/modules/computer_vision/StyleTransferModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class StyleTransferModule extends BaseModule {
2828
model.modelSource
2929
);
3030

31-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
31+
if (!paths?.[0]) {
3232
throw new RnExecutorchError(
3333
RnExecutorchErrorCode.DownloadInterrupted,
3434
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

packages/react-native-executorch/src/modules/general/ExecutorchModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ExecutorchModule extends BaseModule {
2828
onDownloadProgressCallback,
2929
modelSource
3030
);
31-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
31+
if (!paths?.[0]) {
3232
throw new RnExecutorchError(
3333
RnExecutorchErrorCode.DownloadInterrupted,
3434
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

packages/react-native-executorch/src/modules/natural_language_processing/VADModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class VADModule extends BaseModule {
2828
onDownloadProgressCallback,
2929
model.modelSource
3030
);
31-
if (paths === null || paths.length < 1 || paths[0] === undefined) {
31+
if (!paths?.[0]) {
3232
throw new RnExecutorchError(
3333
RnExecutorchErrorCode.DownloadInterrupted,
3434
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'

0 commit comments

Comments
 (0)