Skip to content

Commit b2c48ab

Browse files
Improved "null" handling for optionals
1 parent 8c03dd7 commit b2c48ab

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/optionals.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { optionals } from "swift:../swift";
44

55
export default function Command() {
66
const { isLoading, data, error } = usePromise(async () => {
7-
const inputs = [undefined, "value"];
8-
const promises = inputs.map((input) => optionals(input));
7+
const inputs = [undefined, null, "value"];
8+
const promises = inputs.map((input) => optionals(input)).concat(optionals());
99
const results = await Promise.all(promises);
1010
const formattedResults = results
1111
.map((result, index) => {
12-
return `${inputs[index]} -> ${result}`;
12+
const inputLabel = index < inputs.length ? inputs[index] : "no argument";
13+
return `${inputLabel} -> ${result}`;
1314
})
1415
.join("\n\r");
1516
return formattedResults;

swift/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let package = Package(
77
name: "SwiftAPI",
88
platforms: [.macOS(.v12)],
99
dependencies: [
10-
.package(url: "https://github.com/raycast/extensions-swift-tools.git", from: "1.0.0"),
10+
.package(url: "https://github.com/raycast/extensions-swift-tools.git", from: "1.0.1"),
1111
],
1212
targets: [
1313
.executableTarget(

0 commit comments

Comments
 (0)