flow-immutable-models
Version:
Generates model classes from Flow types using Immutable.js
19 lines (16 loc) • 525 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.endsWithModelType = endsWithModelType;
exports.withoutModelTypeSuffix = withoutModelTypeSuffix;
var modelTypeLength = 'ModelType'.length;
function endsWithModelType(str) {
return !!str && str.length > modelTypeLength && str.indexOf('ModelType') === str.length - modelTypeLength;
}
function withoutModelTypeSuffix(str) {
if (endsWithModelType(str)) {
return str.substring(0, str.length - 'ModelType'.length);
}
return str;
}