Merge pull request #1191 from umap-project/sort-space-first
Do not ignore punctuation when sorting features
This commit is contained in:
commit
cc2c88b978
2 changed files with 9 additions and 1 deletions
|
@ -221,7 +221,6 @@ L.Util.sortFeatures = (features, sortKey) => {
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.localeCompare(valB.toString().toLowerCase(), L.locale || 'en', {
|
.localeCompare(valB.toString().toLowerCase(), L.locale || 'en', {
|
||||||
sensitivity: 'base',
|
sensitivity: 'base',
|
||||||
ignorePunctuation: true,
|
|
||||||
numeric: true,
|
numeric: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -496,5 +496,14 @@ describe('L.Util', function () {
|
||||||
assert.equal(features[1], feat2)
|
assert.equal(features[1], feat2)
|
||||||
assert.equal(features[2], feat3)
|
assert.equal(features[2], feat3)
|
||||||
})
|
})
|
||||||
|
it('should sort feature with space first', function () {
|
||||||
|
feat1.properties.mykey = "1 foo"
|
||||||
|
feat2.properties.mykey = "2 foo"
|
||||||
|
feat3.properties.mykey = "1a foo"
|
||||||
|
let features = L.Util.sortFeatures([feat1, feat2, feat3], "mykey")
|
||||||
|
assert.equal(features[0], feat1)
|
||||||
|
assert.equal(features[1], feat3)
|
||||||
|
assert.equal(features[2], feat2)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue