Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 354x 354x 9265x 9265x 1540x 7725x 7725x 42x 34138x 7683x 34138x | const _ = require('underscore'); export const getMissingRequiredFields = (product: any, scope: string, locale: string): string[] => { const scopeMissingAttributes = _.findWhere(product.meta.required_missing_attributes, {channel: scope}); if (undefined === scopeMissingAttributes) { return []; } const localeMissingAttributes = scopeMissingAttributes.locales[locale]; if (undefined === localeMissingAttributes) { return []; } const missingAttributeCodes = localeMissingAttributes.missing.map((missing: any) => missing.code); const levelAttributeCodes = Object.keys(product.values); return missingAttributeCodes.filter((missingAttribute: string) => levelAttributeCodes.includes(missingAttribute)); }; |