@skypilot/steampress
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -0,1 +1,9 @@ | ||
## 1.3.0 (2019-11-27) | ||
* chg!: Renamed `exclude` to `excludeThisColumn` for clarity ([6c78491](https://github.com/skypilotcc/steampress/commit/6c78491)) | ||
* add: Can check whether cell content matches a regular expression ([d363175](https://github.com/skypilotcc/steampress/commit/d363175)) | ||
* add: Can transform cell content prior to validation ([7fe3fc3](https://github.com/skypilotcc/steampress/commit/7fe3fc3)) | ||
## 1.2.0 (2019-11-26) | ||
@@ -2,0 +10,0 @@ |
@@ -45,2 +45,3 @@ "use strict"; | ||
const { | ||
cellPrevalidationTransformers = [], | ||
cellTransformers = [], | ||
@@ -51,3 +52,3 @@ cellValidators = [], | ||
disallowEmptyCellsInColumn = disallowEmptyCellsInRow, | ||
exclude, | ||
excludeThisColumn, | ||
ignoreRowIfFalsy, | ||
@@ -63,3 +64,3 @@ ignoreRowIfTruthy, | ||
if (cellIsEmpty(actualValue)) { | ||
if (!exclude && defaultValue !== undefined) { | ||
if (!excludeThisColumn && defaultValue !== undefined) { | ||
transformedRow[outputProperty] = defaultValue; | ||
@@ -74,3 +75,3 @@ return; | ||
} | ||
} else if (!exclude && disallowEmptyCellsInColumn) { | ||
} else if (!excludeThisColumn && disallowEmptyCellsInColumn) { | ||
throw new Error(`ERROR: Row ${rowIndex + 1} contains no value for '${outputProperty}', but the cell cannot be empty and no default value has been set`); | ||
@@ -81,3 +82,3 @@ } | ||
} else { | ||
initialValue = actualValue; | ||
initialValue = (0, _transform.transform)(actualValue, cellPrevalidationTransformers); | ||
} | ||
@@ -90,3 +91,3 @@ | ||
if (exclude) { | ||
if (excludeThisColumn) { | ||
return; | ||
@@ -93,0 +94,0 @@ } |
@@ -13,2 +13,3 @@ import { Integer, JsonObject } from '@skypilot/common-types'; | ||
export interface ParseColumnOptions { | ||
cellPrevalidationTransformers?: Transformer[]; | ||
cellTransformers?: Transformer[]; | ||
@@ -19,3 +20,3 @@ cellValidators?: Validator[]; | ||
disallowEmptyCellsInColumn?: boolean; | ||
exclude?: boolean | ((...args: any[]) => boolean); | ||
excludeThisColumn?: boolean | ((...args: any[]) => boolean); | ||
expectedHeader?: string; | ||
@@ -22,0 +23,0 @@ ignoreRowIf?: IgnoreRowIf; |
export * from './excel'; | ||
export * from './transformers'; | ||
export * from './validators'; |
@@ -29,2 +29,14 @@ "use strict"; | ||
}); | ||
}); | ||
var _validators = require("./validators"); | ||
Object.keys(_validators).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _validators[key]; | ||
} | ||
}); | ||
}); |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/skypilotcc/steampress#readme", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"main": "lib/index.js", | ||
@@ -8,0 +8,0 @@ "author": { |
33132
43
740