src/modules/ParseIntBasedZipCodeValidator.ts

Summary

Maintainability
A
0 mins
Test Coverage
// 我们经常会去扩展其它模块,并且只导出那个模块的部分内容。
// 重新导出功能并不会在当前模块导入那个模块或定义一个新的局部变量。

export class ParseIntBasedZipCodeValidator {
    public isAcceptable(s: string) {
        return s.length === 5 && parseInt(s, 10).toString() === s;
    }
}

// 导出原先的验证器但做了重命名
export {
    ZipCodeValidator as RegExpBasedZipCodeValidator
} from './ZipCodeValidator';