mirror of
https://github.com/denoland/deno.git
synced 2025-09-29 21:54:48 +00:00
Update to Prettier 2 and use ES Private Fields (#4498)
This commit is contained in:
parent
1397b8e0e7
commit
bced52505f
329 changed files with 2787 additions and 2430 deletions
|
@ -223,7 +223,7 @@ export function createAlgorithmFromUnderlyingMethod<
|
|||
if (typeof method !== "function") {
|
||||
throw new TypeError(`Field "${methodName}" is not a function.`);
|
||||
}
|
||||
return function(...fnArgs: any[]): any {
|
||||
return function (...fnArgs: any[]): any {
|
||||
return promiseCall(method, obj, fnArgs.concat(extraArgs));
|
||||
};
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ export function makeSizeAlgorithmFromSizeFunction<T>(
|
|||
if (typeof sizeFn !== "function" && typeof sizeFn !== "undefined") {
|
||||
throw new TypeError("size function must be undefined or a function");
|
||||
}
|
||||
return function(chunk: T): number {
|
||||
return function (chunk: T): number {
|
||||
if (typeof sizeFn === "function") {
|
||||
return sizeFn(chunk);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ export function makeSizeAlgorithmFromSizeFunction<T>(
|
|||
export const enum ControlledPromiseState {
|
||||
Pending,
|
||||
Resolved,
|
||||
Rejected
|
||||
Rejected,
|
||||
}
|
||||
|
||||
export interface ControlledPromise<V> {
|
||||
|
@ -277,14 +277,14 @@ export interface ControlledPromise<V> {
|
|||
|
||||
export function createControlledPromise<V>(): ControlledPromise<V> {
|
||||
const conProm = {
|
||||
state: ControlledPromiseState.Pending
|
||||
state: ControlledPromiseState.Pending,
|
||||
} as ControlledPromise<V>;
|
||||
conProm.promise = new Promise<V>(function(resolve, reject) {
|
||||
conProm.resolve = function(v?: V): void {
|
||||
conProm.promise = new Promise<V>(function (resolve, reject) {
|
||||
conProm.resolve = function (v?: V): void {
|
||||
conProm.state = ControlledPromiseState.Resolved;
|
||||
resolve(v);
|
||||
};
|
||||
conProm.reject = function(e?: ErrorResult): void {
|
||||
conProm.reject = function (e?: ErrorResult): void {
|
||||
conProm.state = ControlledPromiseState.Rejected;
|
||||
reject(e);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue