Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Fixed handling of unicode characters and non-letter characters in PROPER function. (#811)
- Fixed unncessary warnings of deprecated config options. (#830)
- Fixed SUMPRODUCT function. (#810)

## [1.2.0] - 2021-09-23
Expand Down
19 changes: 8 additions & 11 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,14 @@ export interface ConfigParams {
useWildcards: boolean,
}

export type ConfigParamsList = keyof ConfigParams
export type ConfigParamsNoDeprecated = Omit<ConfigParams, 'binarySearchThreshold'>
Comment thread
izulin marked this conversation as resolved.
Resolved

export class Config implements ConfigParams, ParserConfig {
export type ConfigParamsList = keyof ConfigParamsNoDeprecated

public static defaultConfig: ConfigParams = {
export class Config implements ConfigParamsNoDeprecated, ParserConfig {

public static defaultConfig: ConfigParamsNoDeprecated = {
accentSensitive: false,
binarySearchThreshold: 20,
currencySymbol: ['$'],
caseSensitive: false,
caseFirst: 'lower',
Expand Down Expand Up @@ -552,8 +553,6 @@ export class Config implements ConfigParams, ParserConfig {
/** @inheritDoc */
public readonly useStats: boolean
/** @inheritDoc */
public readonly binarySearchThreshold: number
/** @inheritDoc */
public readonly nullDate: SimpleDate
/** @inheritDoc */
public readonly currencySymbol: string[]
Expand Down Expand Up @@ -662,8 +661,6 @@ export class Config implements ConfigParams, ParserConfig {
validateNumberToBeAtLeast(this.precisionEpsilon, 'precisionEpsilon', 0)
this.useColumnIndex = configValueFromParam(useColumnIndex, 'boolean', 'useColumnIndex')
this.useStats = configValueFromParam(useStats, 'boolean', 'useStats')
this.binarySearchThreshold = configValueFromParam(binarySearchThreshold, 'number', 'binarySearchThreshold')
validateNumberToBeAtLeast(this.binarySearchThreshold, 'binarySearchThreshold', 1)
this.parseDateTime = configValueFromParam(parseDateTime, 'function', 'parseDateTime')
this.stringifyDateTime = configValueFromParam(stringifyDateTime, 'function', 'stringifyDateTime')
this.stringifyDuration = configValueFromParam(stringifyDuration, 'function', 'stringifyDuration')
Expand Down Expand Up @@ -711,7 +708,7 @@ export class Config implements ConfigParams, ParserConfig {
)
}

public getConfig(): ConfigParams {
public getConfig(): ConfigParamsNoDeprecated {
const ret: { [key: string]: any } = {}
for (const key in Config.defaultConfig) {
const val = this[key as ConfigParamsList]
Expand All @@ -721,12 +718,12 @@ export class Config implements ConfigParams, ParserConfig {
ret[key] = val
}
}
return ret as ConfigParams
return ret as ConfigParamsNoDeprecated
}


public mergeConfig(init: Partial<ConfigParams>): Config {
const mergedConfig: ConfigParams = Object.assign({}, this.getConfig(), init)
const mergedConfig: ConfigParamsNoDeprecated = Object.assign({}, this.getConfig(), init)

return new Config(mergedConfig)
}
Expand Down
4 changes: 2 additions & 2 deletions src/HyperFormula.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from './Cell'
import {CellContent, CellContentParser, RawCellContent} from './CellContentParser'
import {CellValue} from './CellValue'
import {Config, ConfigParams} from './Config'
import {Config, ConfigParams, ConfigParamsNoDeprecated} from './Config'
Comment thread
izulin marked this conversation as resolved.
Resolved
import {ColumnRowIndex, CrudOperations} from './CrudOperations'
import {DateTime, numberToSimpleTime} from './DateTimeHelper'
import {
Expand Down Expand Up @@ -971,7 +971,7 @@ export class HyperFormula implements TypedEmitter {
*
* @category Instance
*/
public getConfig(): ConfigParams {
public getConfig(): ConfigParamsNoDeprecated {
Comment thread
izulin marked this conversation as resolved.
Resolved
return this._config.getConfig()
}

Expand Down