UNPKG

@slsplus/migrate

Version:
52 lines (51 loc) 1.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isFrameworkComponent = exports.isBaseComponent = exports.COMPONENTS = exports.addProperty = exports.isEmptyObject = exports.isUndefined = exports.isObject = exports.deepClone = exports.typeOf = void 0; var tslib_1 = require("tslib"); var object_1 = require("@ygkit/object"); Object.defineProperty(exports, "typeOf", { enumerable: true, get: function () { return object_1.typeOf; } }); Object.defineProperty(exports, "deepClone", { enumerable: true, get: function () { return object_1.deepClone; } }); var isUndefined = function (val) { return val === undefined; }; exports.isUndefined = isUndefined; var isObject = function (obj) { return object_1.typeOf(obj) === 'Object'; }; exports.isObject = isObject; var isEmptyObject = function (obj) { return Object.keys(obj).length === 0; }; exports.isEmptyObject = isEmptyObject; var FRAMEWORK_COMPONENTS = [ 'express', 'koa', 'egg', 'nextjs', 'nuxtjs', 'nestjs', 'flask', 'django', 'laravel', 'thinkphp', ]; var BASE_COMPONENTS = ['scf', 'apigateway', 'cos', 'layer', 'cdn', 'vpc', 'postgresql']; var COMPONENTS = tslib_1.__spread(BASE_COMPONENTS, FRAMEWORK_COMPONENTS); exports.COMPONENTS = COMPONENTS; var isBaseComponent = function (name) { return BASE_COMPONENTS.indexOf(name) !== -1; }; exports.isBaseComponent = isBaseComponent; var isFrameworkComponent = function (name) { if (name === void 0) { name = 'framework'; } return FRAMEWORK_COMPONENTS.indexOf(name) !== -1; }; exports.isFrameworkComponent = isFrameworkComponent; var addProperty = function (obj, prop, value) { if (!isUndefined(value)) { obj = obj || {}; obj[prop] = value; return obj; } }; exports.addProperty = addProperty;