swc/bundler/tests/.cache/deno/53ef97cc19ddbc4e5d1af12c8f1ff41cceee0f48.ts
강동윤 1178686a4c
fix(bundler): Fix bundler (#1576)
swc_bundler:
 - Fix remapping of exports. (denoland/deno#9350)
2021-04-16 18:09:38 +00:00

18 lines
534 B
TypeScript

// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/flags/lib/types/boolean.ts
import { IFlagArgument, IFlagOptions, ITypeHandler } from '../types.ts';
export const boolean: ITypeHandler<boolean> = ( option: IFlagOptions, arg: IFlagArgument, value: string ): boolean => {
if ( ~[ '1', 'true' ].indexOf( value ) ) {
return true;
}
if ( ~[ '0', 'false' ].indexOf( value ) ) {
return false;
}
throw new Error( `Option --${ option.name } must be of type boolean but got: ${ value }` );
};