From 70fb0da35aaff092df3fa365a6798edf0787c650 Mon Sep 17 00:00:00 2001 From: OFF0 Date: Sat, 11 Mar 2023 11:31:06 +0100 Subject: [PATCH] utils: import directly from utils it is not worth to import everything from utils, as there are too many functions, better import them directly from each module. --- src/events.ts | 2 +- src/main.js | 5 ++++- src/utils/index.ts | 4 ---- src/view.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 src/utils/index.ts diff --git a/src/events.ts b/src/events.ts index a4d90eb..8ed8064 100644 --- a/src/events.ts +++ b/src/events.ts @@ -1,5 +1,5 @@ import {Event} from 'nostr-tools'; -import {zeroLeadingBitsCount} from './utils'; +import {zeroLeadingBitsCount} from './utils/crypto'; export const isMention = ([tag, , , marker]: string[]) => tag === 'e' && marker === 'mention'; export const hasEventTag = (tag: string[]) => tag[0] === 'e'; diff --git a/src/main.js b/src/main.js index 221d00f..940d882 100644 --- a/src/main.js +++ b/src/main.js @@ -1,9 +1,12 @@ import {generatePrivateKey, getEventHash, getPublicKey, nip19, signEvent} from 'nostr-tools'; +import {zeroLeadingBitsCount} from './utils/crypto'; +import {elem, elemCanvas, elemShrink, parseTextContent} from './utils/dom'; +import {bounce, dateTime, formatTime} from './utils/time'; +import {getHost, getNoxyUrl, isWssUrl} from './utils/url'; import {sub24hFeed, subNote, subProfile} from './subscriptions' import {publish} from './relays'; import {getReplyTo, hasEventTag, isMention, sortByCreatedAt, sortEventCreatedAt, validatePow} from './events'; import {clearView, getViewContent, getViewElem, setViewElem, view} from './view'; -import {bounce, dateTime, elem, elemCanvas, elemShrink, formatTime, getHost, getNoxyUrl, isWssUrl, parseTextContent, zeroLeadingBitsCount} from './utils'; // curl -H 'accept: application/nostr+json' https://relay.nostr.ch/ function onEvent(evt, relay) { diff --git a/src/utils/index.ts b/src/utils/index.ts deleted file mode 100644 index de96166..0000000 --- a/src/utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export {zeroLeadingBitsCount} from './crypto'; -export {elem, elemCanvas, elemShrink, parseTextContent} from './dom'; -export {bounce, dateTime, formatTime} from './time'; -export {getHost, getNoxyUrl, isHttpUrl, isWssUrl} from './url'; diff --git a/src/view.ts b/src/view.ts index 8cbda1d..79d8b53 100644 --- a/src/view.ts +++ b/src/view.ts @@ -1,4 +1,4 @@ -import {elem} from './utils'; +import {elem} from './utils/dom'; type Container = { id: string;