Skip to content

Commit aa6e13c

Browse files
committed
Merge branch 'release/0.6.1'
2 parents 7ff3ab7 + de770be commit aa6e13c

File tree

10 files changed

+1754
-1595
lines changed

10 files changed

+1754
-1595
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.6.1] - 2021-05-24
10+
11+
### Changed
12+
- Remove redundant `'assert'` dependency from the code. (#672)
13+
14+
### Fixed
15+
- Fixed library support for IE11. The `unorm` package is added to the dependencies. (#675)
16+
917
## [0.6.0] - 2021-04-27
1018

1119
### Changed

docs/guide/dependencies.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ features.
66

77
| Name | License | Author |
88
| :--- | :--- | :--- |
9+
| [bessel](https://github.com/SheetJS/bessel) | Apache v2.0 | SheetJS |
910
| [Chevrotain](https://github.com/SAP/chevrotain) | Apache v2.0 | SAP SE or an SAP affiliate company |
10-
| [GPU.js](https://github.com/gpujs/gpu.js/) ([optional](enabling-gpu-acceleration.md)) | The MIT License | gpu.js Team |
1111
| [core-js](https://github.com/zloirock/core-js) | The MIT License | Denis Pushkarev |
12-
| [tiny-emitter](https://github.com/scottcorgan/tiny-emitter) | The MIT License | Scott Corgan |
13-
| [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime) | The MIT License | Facebook, Inc. |
12+
| [GPU.js](https://github.com/gpujs/gpu.js/) ([optional](enabling-gpu-acceleration.md)) | The MIT License | gpu.js Team |
1413
| [jStat](https://github.com/jstat/jstat) | The MIT License | jStat |
15-
| [bessel](https://github.com/SheetJS/bessel) | Apache v2.0 | SheetJS |
14+
| [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime) | The MIT License | Facebook, Inc. |
15+
| [tiny-emitter](https://github.com/scottcorgan/tiny-emitter) | The MIT License | Scott Corgan |
16+
| [unorm](https://github.com/walling/unorm) | The MIT or GPL-2.0 License | Matsuza, Bjarke Walling |
1617

1718
<br>
1819

ht.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ module.exports = {
66
HT_VERSION: packageBody.version,
77
HT_PACKAGE_NAME: packageBody.name,
88
HT_BUILD_DATE: moment().format('DD/MM/YYYY HH:mm:ss'),
9-
HT_RELEASE_DATE: '27/04/2021',
9+
HT_RELEASE_DATE: '24/05/2021',
1010
};

package-lock.json

Lines changed: 1223 additions & 1098 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "https://github.com/handsontable/hyperformula/issues"
1111
},
1212
"author": "Handsoncode <hello@handsontable.com>",
13-
"version": "0.6.0",
13+
"version": "0.6.1",
1414
"keywords": [
1515
"formula",
1616
"spreadsheet",
@@ -94,6 +94,7 @@
9494
"@types/jest": "^25.1.3",
9595
"@types/jsdom": "^16.2.1",
9696
"@types/node": "^10.17.19",
97+
"@types/unorm": "^1.3.28",
9798
"@types/webpack-env": "^1.15.2",
9899
"@typescript-eslint/eslint-plugin": "^2.20.0",
99100
"@typescript-eslint/parser": "^2.20.0",
@@ -144,7 +145,8 @@
144145
"chevrotain": "^6.5.0",
145146
"core-js": "^3.6.4",
146147
"regenerator-runtime": "^0.13.3",
147-
"tiny-emitter": "^2.1.0"
148+
"tiny-emitter": "^2.1.0",
149+
"unorm": "^1.6.0"
148150
},
149151
"optionalDependencies": {
150152
"gpu.js": "2.3.0"

src/DependencyGraph/DependencyGraph.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright (c) 2021 Handsoncode. All rights reserved.
44
*/
55

6-
import assert from 'assert'
76
import {AbsoluteCellRange} from '../AbsoluteCellRange'
87
import {absolutizeDependencies} from '../absolutizeDependencies'
98
import {
@@ -157,7 +156,9 @@ export class DependencyGraph {
157156
}
158157

159158
public ensureThatVertexIsNonMatrixCellVertex(vertex: CellVertex | null) {
160-
assert.ok(!(vertex instanceof MatrixVertex), 'Illegal operation')
159+
if (vertex instanceof MatrixVertex) {
160+
throw new Error('Illegal operation')
161+
}
161162
}
162163

163164
public clearRecentlyChangedVertices() {

src/interpreter/ArithmeticHelper.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (c) 2021 Handsoncode. All rights reserved.
44
*/
55

6+
import unorm from 'unorm'
67
import {CellError, CellValueTypeOrd, ErrorType, getCellValueType} from '../Cell'
78
import {Config} from '../Config'
89
import {DateTimeHelper} from '../DateTimeHelper'
@@ -115,7 +116,7 @@ export class ArithmeticHelper {
115116
str = str.toLowerCase()
116117
}
117118
if(!this.config.accentSensitive) {
118-
str = str.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
119+
str = normalizeString(str, 'nfd').replace(/[\u0300-\u036f]/g, '')
119120
}
120121
return str
121122
}
@@ -758,6 +759,12 @@ function inferExtendedNumberTypeMultiplicative(leftArg: ExtendedNumber, rightArg
758759
}
759760

760761
export function forceNormalizeString(str: string): string {
761-
return str.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '')
762+
return normalizeString(str.toLowerCase(), 'nfd').replace(/[\u0300-\u036f]/g, '')
762763
}
763764

765+
type NormalizationForm = 'nfc' | 'nfd' | 'nfkc' | 'nfkd'
766+
767+
export function normalizeString(str: string, form: NormalizationForm): string {
768+
return typeof str.normalize === 'function'
769+
? str.normalize(form.toUpperCase()) : unorm[form](str)
770+
}

src/interpreter/plugin/NumericAggregationPlugin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright (c) 2021 Handsoncode. All rights reserved.
44
*/
55

6-
import assert from 'assert'
76
import {AbsoluteCellRange, DIFFERENT_SHEETS_ERROR} from '../../AbsoluteCellRange'
87
import {CellError, ErrorType, SimpleCellAddress} from '../../Cell'
98
import {ErrorMessage} from '../../error-message'
@@ -545,7 +544,10 @@ export class NumericAggregationPlugin extends FunctionPlugin {
545544
const rangeStart = range.start
546545
const rangeEnd = range.end
547546
const rangeVertex = this.dependencyGraph.getRange(rangeStart, rangeEnd)!
548-
assert.ok(rangeVertex, 'Range does not exists in graph')
547+
548+
if (!rangeVertex) {
549+
throw new Error('Range does not exists in graph')
550+
}
549551

550552
let value = rangeVertex.getFunctionValue(functionName) as (T | CellError)
551553
if (!value) {
@@ -629,4 +631,3 @@ function numbersBooleans(arg: InternalScalarValue): Maybe<CellError | ExtendedNu
629631
return undefined
630632
}
631633
}
632-

test/column-index.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,21 @@ describe('ColumnIndex#add', () => {
9595
index.add('A', adr('A2'))
9696
index.add('ą', adr('A3'))
9797

98+
// Some strings don't have a canonical form, so for them, the index is created as usual.
99+
index.add('l', adr('A4'))
100+
index.add('ł', adr('A5'))
101+
index.add('t', adr('A6'))
102+
index.add('ŧ', adr('A7'))
103+
98104
const columnMap = index.getColumnMap(0, 0)
99105

100-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
106+
// eslint-disable @typescript-eslint/no-non-null-assertion
101107
expect(columnMap.get('a')!.index.length).toBe(3)
108+
expect(columnMap.get('l')!.index.length).toBe(1)
109+
expect(columnMap.get('ł')!.index.length).toBe(1)
110+
expect(columnMap.get('t')!.index.length).toBe(1)
111+
expect(columnMap.get('ŧ')!.index.length).toBe(1)
112+
// eslint-enable @typescript-eslint/no-non-null-assertion
102113
})
103114
})
104115

0 commit comments

Comments
 (0)