UNPKG

@8bittitan/norse

Version:

Nodejs cli for scaffolding Mongoose models

22 lines 734 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var chalk_1 = __importDefault(require("chalk")); var makeKeyValue = function (attributes) { return ({ name: attributes[0], type: attributes[1], }); }; exports.default = (function (field) { var s = field.split(':'); if (s.length === 1) { s[1] = 'String'; } if (s.length !== 2) { console.log(chalk_1.default.red('Your field must be in the format of `[fieldName]:[fieldType]`')); process.exit(1); } return makeKeyValue(s); }); //# sourceMappingURL=parseField.js.map