diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-03-10 04:30:38 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-09 12:30:38 -0500 |
commit | 034e2cc02829c9244b32232074c7a48af827a2fb (patch) | |
tree | bade01606a1ee076c1f753ce99c97ddb1e4edf30 /js/stat.ts | |
parent | 8c7a12d1b258f0ef5ab27f49c424331d43e8d97f (diff) |
Migrate from tslint to eslint for linting (#1905)
Diffstat (limited to 'js/stat.ts')
-rw-r--r-- | js/stat.ts | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/js/stat.ts b/js/stat.ts index 4d04ea221..9f99ab441 100644 --- a/js/stat.ts +++ b/js/stat.ts @@ -5,6 +5,27 @@ import * as dispatch from "./dispatch"; import { assert } from "./util"; import { FileInfo, FileInfoImpl } from "./file_info"; +function req( + filename: string, + lstat: boolean +): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { + const builder = flatbuffers.createBuilder(); + const filename_ = builder.createString(filename); + msg.Stat.startStat(builder); + msg.Stat.addFilename(builder, filename_); + msg.Stat.addLstat(builder, lstat); + const inner = msg.Stat.endStat(builder); + return [builder, msg.Any.Stat, inner]; +} + +function res(baseRes: null | msg.Base): FileInfo { + assert(baseRes != null); + assert(msg.Any.StatRes === baseRes!.innerType()); + const res = new msg.StatRes(); + assert(baseRes!.inner(res) != null); + return new FileInfoImpl(res); +} + /** Queries the file system for information on the path provided. If the given * path is a symlink information about the symlink will be returned. * @@ -45,24 +66,3 @@ export async function stat(filename: string): Promise<FileInfo> { export function statSync(filename: string): FileInfo { return res(dispatch.sendSync(...req(filename, false))); } - -function req( - filename: string, - lstat: boolean -): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { - const builder = flatbuffers.createBuilder(); - const filename_ = builder.createString(filename); - msg.Stat.startStat(builder); - msg.Stat.addFilename(builder, filename_); - msg.Stat.addLstat(builder, lstat); - const inner = msg.Stat.endStat(builder); - return [builder, msg.Any.Stat, inner]; -} - -function res(baseRes: null | msg.Base): FileInfo { - assert(baseRes != null); - assert(msg.Any.StatRes === baseRes!.innerType()); - const res = new msg.StatRes(); - assert(baseRes!.inner(res) != null); - return new FileInfoImpl(res); -} |