@abp/ng.schematics
Advanced tools
Comparing version 3.2.1 to 3.3.0-rc.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core_1 = require("@angular-devkit/core"); | ||
const enums_1 = require("../enums"); | ||
const utils_1 = require("../utils"); | ||
class Method { | ||
@@ -27,3 +27,3 @@ constructor(options) { | ||
const { bindingSourceId, descriptorName, name, nameOnMethod } = param; | ||
const camelName = core_1.strings.camelize(name); | ||
const camelName = utils_1.camel(name); | ||
const value = descriptorName ? `${descriptorName}.${camelName}` : nameOnMethod; | ||
@@ -30,0 +30,0 @@ switch (bindingSourceId) { |
{ | ||
"name": "@abp/ng.schematics", | ||
"version": "3.2.1", | ||
"version": "3.3.0-rc.1", | ||
"description": "Schematics that works with ABP Backend", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core_1 = require("@angular-devkit/core"); | ||
const constants_1 = require("../constants"); | ||
@@ -8,2 +7,3 @@ const models_1 = require("../models"); | ||
const path_1 = require("./path"); | ||
const text_1 = require("./text"); | ||
const tree_1 = require("./tree"); | ||
@@ -95,3 +95,3 @@ const type_1 = require("./type"); | ||
(_b = typeDef.properties) === null || _b === void 0 ? void 0 : _b.forEach(prop => { | ||
const name = core_1.strings.camelize(prop.name); | ||
const name = text_1.camel(prop.name); | ||
const optional = prop.typeSimple.endsWith('?') ? '?' : ''; | ||
@@ -107,4 +107,6 @@ const type = simplifyType(prop.typeSimple); | ||
var _a; | ||
if (((_a = types[type]) === null || _a === void 0 ? void 0 : _a.isEnum) || type === _interface.ref) | ||
if ((_a = types[type]) === null || _a === void 0 ? void 0 : _a.isEnum) | ||
return; | ||
if (interfaces.some(i => i.ref === type)) | ||
return; | ||
refs.push(type); | ||
@@ -111,0 +113,0 @@ }); |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.upper = (text) => text.toUpperCase(); | ||
exports.camel = (text) => core_1.strings.camelize(_(text)); | ||
exports.camel = (text) => toCamelCase(_(text)); | ||
exports.pascal = (text) => core_1.strings.classify(_(text)); | ||
@@ -16,2 +16,31 @@ exports.kebab = (text) => core_1.strings.dasherize(_(text)); | ||
} | ||
// https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Utilities/StringUtils.cs#L155 | ||
function toCamelCase(str) { | ||
if (!str || !isUpperCase(str[0])) | ||
return str; | ||
const chars = str.split(''); | ||
const { length } = chars; | ||
for (let i = 0; i < length; i++) { | ||
if (i === 1 && !isUpperCase(chars[i])) | ||
break; | ||
const hasNext = i + 1 < length; | ||
if (i > 0 && hasNext && !isUpperCase(chars[i + 1])) { | ||
if (isSeparator(chars[i + 1])) { | ||
chars[i] = toLowerCase(chars[i]); | ||
} | ||
break; | ||
} | ||
chars[i] = toLowerCase(chars[i]); | ||
} | ||
return chars.join(''); | ||
} | ||
function isSeparator(str = '') { | ||
return /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/.test(str); | ||
} | ||
function isUpperCase(str = '') { | ||
return /[A-Z]+/.test(str); | ||
} | ||
function toLowerCase(str = '') { | ||
return str.toLowerCase(); | ||
} | ||
//# sourceMappingURL=text.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
286679
4566
2