Skip to content

Commit

Permalink
fix(collate): avoid using \u0000 for indexing
Browse files Browse the repository at this point in the history
Use \u0003 instead
  • Loading branch information
craftzdog committed Apr 30, 2022
1 parent 1d50550 commit 228f682
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/node_modules/pouchdb-collate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pouchdb-collate",
"version": "7.0.0-prerelease",
"name": "@craftzdog/pouchdb-collate-react-native",
"version": "7.3.0",
"description": "Collation functions for PouchDB map/reduce",
"main": "lib/index.js",
"keywords": [
Expand Down
8 changes: 4 additions & 4 deletions packages/node_modules/pouchdb-collate/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function indexify(key) {
// for lexical sorting, e.g. within a database, where the
// sorting is the same given by the collate() function.
function toIndexableString(key) {
var zero = '\u0000';
var zero = '\u0003';
key = normalizeKey(key);
return collationIndex(key) + SEP + indexify(key) + zero;
}
Expand All @@ -139,7 +139,7 @@ function parseNumber(str, i) {
i += MAGNITUDE_DIGITS;
while (true) {
var ch = str[i];
if (ch === '\u0000') {
if (ch === '\u0003') {
break;
} else {
numAsString += ch;
Expand Down Expand Up @@ -201,7 +201,7 @@ function parseIndexableString(str) {
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
while (true) {
var collationIndex = str[i++];
if (collationIndex === '\u0000') {
if (collationIndex === '\u0003') {
if (stack.length === 1) {
return stack.pop();
} else {
Expand All @@ -227,7 +227,7 @@ function parseIndexableString(str) {
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
while (true) {
var ch = str[i];
if (ch === '\u0000') {
if (ch === '\u0003') {
break;
}
parsedStr += ch;
Expand Down

0 comments on commit 228f682

Please sign in to comment.