Skip to content

Commit 8ffac33

Browse files
authored
Merge pull request #53 from gamoutatsumi/main
🚿 Remove check `undefined` in functions
2 parents 939fa6f + 7fb3bb6 commit 8ffac33

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

denops_std/function/buffer.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ export async function getbufline(
212212
lnum: string | number,
213213
end?: string | number,
214214
): Promise<string[]> {
215-
if (end == undefined) {
216-
return await denops.call("getbufline", expr, lnum) as string[];
217-
}
218215
return await denops.call("getbufline", expr, lnum, end) as string[];
219216
}
220217

denops_std/function/common.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,7 @@ export async function has(
141141
feature: string,
142142
check?: boolean,
143143
): Promise<boolean> {
144-
if (check) {
145-
const result = await denops.call("has", feature, 1) as number;
146-
return !!result;
147-
}
148-
const result = await denops.call("has", feature) as number;
144+
const result = await denops.call("has", feature, check) as number;
149145
return !!result;
150146
}
151147

@@ -187,10 +183,7 @@ export async function getline(
187183
lnum: string | number,
188184
end?: string | number,
189185
): Promise<string | string[]> {
190-
if (end) {
191-
return await denops.call("getline", lnum, end) as string[];
192-
}
193-
return await denops.call("getline", lnum) as string;
186+
return await denops.call("getline", lnum, end) as string;
194187
}
195188

196189
/**

0 commit comments

Comments
 (0)