swc/bundler/tests/.cache/deno/4c8bf1516cc3178a1924a1bb5cf7f135b84b8759.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

24 lines
546 B
TypeScript

// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isEmpty.ts
// @ts-ignore allowing typedoc to build
import { assertString } from '../helpers/assertString.ts';
type EmptyOptions = {
ignoreWhitespace?: boolean;
};
/**
* @ignore
*/
const defaultEmptyOptions: EmptyOptions = {
ignoreWhitespace: false,
};
export const isEmpty = (str: string, options?: EmptyOptions) => {
assertString(str);
options = { ...defaultEmptyOptions, ...options };
return (options.ignoreWhitespace ? str.trim().length : str.length) === 0;
};