grunt-generate-view-model
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -85,7 +85,10 @@ "use strict"; | ||
exports.getInfoFromImports = getInfoFromImports; | ||
const updateFieldMetadataForIgnoreDecorators = (ignoreDecorators, classMeta, fldMetadata, decoratorsOnField, fileStructure) => { | ||
const updateFieldMetadataForIgnoreDecorators = (ignoreDecorators_, classMeta, fldMetadata, decoratorsOnField, fileStructure) => { | ||
const newFldMetadata = Object.assign({}, fldMetadata); | ||
const noIgnoreDecorators = !ignoreDecorators.length; | ||
const fieldIgnoreDecorators = [...(ignoreDecorators.map(dec => dec.arguments[0]) || []), ...ignoreDecorators]; | ||
const fieldIgnoreDecoratorsClasses = (ignoreDecorators.map(dec => dec.arguments[1]) || []); | ||
const ignoreAllDecoratorsExist = ignoreDecorators_.find(d => { var _a; return ((_a = d.arguments) === null || _a === void 0 ? void 0 : _a.length) === 0; }); | ||
const ignoreDecoratorsForFieldArray = ignoreDecorators_.map(dec => dec.arguments[0]) || []; | ||
const allIgnoreCustomFields = []; | ||
ignoreDecoratorsForFieldArray.forEach((d) => allIgnoreCustomFields.push(...(d || []))); | ||
const fieldIgnoreDecorators = [...allIgnoreCustomFields, ...ignoreDecorators_1.ignoreDecorators]; | ||
const fieldIgnoreDecoratorsClasses = (ignoreDecorators_.map(dec => dec.arguments[1]) || []); | ||
if (!decoratorsOnField || !decoratorsOnField.length) { | ||
@@ -100,4 +103,7 @@ newFldMetadata.decorators = []; | ||
newFldMetadata.decorators = decoratorsOnField.filter(dec => { | ||
const isDecoratorAvailableForField = noIgnoreDecorators && !fieldIgnoreDecorators.includes(dec.name); | ||
const isDecoratorAvailableForClass = noIgnoreDecorators && !fieldIgnoreDecoratorsClasses.includes(classMeta.name); | ||
if (ignoreAllDecoratorsExist) { | ||
return false; | ||
} | ||
const isDecoratorAvailableForField = !fieldIgnoreDecorators.includes(dec.name); | ||
const isDecoratorAvailableForClass = !fieldIgnoreDecoratorsClasses.includes(classMeta.name); | ||
return isDecoratorAvailableForClass && isDecoratorAvailableForField; | ||
@@ -104,0 +110,0 @@ }); |
{ | ||
"name": "grunt-generate-view-model", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Global task for generation view model", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
200404
92
2155
5