Skip to content

Commit 7689c8a

Browse files
committed
[common] dot
1 parent f66c012 commit 7689c8a

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/common/strings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const getTypeOf = (thing: unknown): string => typeof thing;
55
export const TINYBASE = 'tinybase';
66
export const EMPTY_STRING = '';
77
export const COMMA = ',';
8+
export const DOT = '.';
89

910
export const STRING = getTypeOf(EMPTY_STRING);
1011
export const BOOLEAN = getTypeOf(true);

src/persisters/common/database/common.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import type {
55
} from '../../../@types/persisters/index.d.ts';
66
import {arrayJoin, arrayMap} from '../../../common/array.ts';
77
import {IdSet} from '../../../common/set.ts';
8-
import {COMMA, strReplace, strSplit, TRUE} from '../../../common/strings.ts';
8+
import {
9+
COMMA,
10+
DOT,
11+
strReplace,
12+
strSplit,
13+
TRUE,
14+
} from '../../../common/strings.ts';
915

1016
export type QuerySchema = (
1117
executeCommand: DatabaseExecuteCommand,
@@ -57,8 +63,8 @@ export const getWrappedCommand = (
5763

5864
export const escapeId = (str: string) =>
5965
arrayJoin(
60-
arrayMap(strSplit(str, '.'), (part) => `"${strReplace(part, /"/g, '""')}"`),
61-
'.',
66+
arrayMap(strSplit(str, DOT), (part) => `"${strReplace(part, /"/g, '""')}"`),
67+
DOT,
6268
);
6369

6470
export const escapeIds = (...ids: Ids) => escapeId(arrayJoin(ids, '_'));

src/synchronizers/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
tryCatch,
3535
} from '../common/other.ts';
3636
import {getLatestTime, stampNew, stampNewObj} from '../common/stamps.ts';
37-
import {EMPTY_STRING} from '../common/strings.ts';
37+
import {DOT, EMPTY_STRING} from '../common/strings.ts';
3838
import {createCustomPersister} from '../persisters/index.ts';
3939

4040
const enum MessageValues {
@@ -105,7 +105,7 @@ export const createCustomSynchronizer = (
105105
transactionId: Id,
106106
): Promise<[response: Response, fromClientId: Id, transactionId: Id]> =>
107107
promiseNew((resolve, reject) => {
108-
const requestId = transactionId + '.' + getUniqueId(4);
108+
const requestId = transactionId + DOT + getUniqueId(4);
109109
const timeout = startTimeout(() => {
110110
collDel(pendingRequests, requestId);
111111
reject(

src/ui-react-dom/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
BOOLEAN,
5353
CELL,
5454
CURRENT_TARGET,
55+
DOT,
5556
EMPTY_STRING,
5657
NUMBER,
5758
STRING,
@@ -119,7 +120,6 @@ type RelationshipInHtmlRowParams = [
119120
store: Store | undefined,
120121
];
121122

122-
const DOT = '.';
123123
const EDITABLE = 'editable';
124124
const LEFT_ARROW = '\u2190';
125125
const UP_ARROW = '\u2191';

0 commit comments

Comments
 (0)