mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 07:04:19 +01:00
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
'use strict'
|
|
|
|
let list = {
|
|
comma(string) {
|
|
return list.split(string, [','], true)
|
|
},
|
|
|
|
space(string) {
|
|
let spaces = [' ', '\n', '\t']
|
|
return list.split(string, spaces)
|
|
},
|
|
|
|
split(string, separators, last) {
|
|
let array = []
|
|
let current = ''
|
|
let split = false
|
|
|
|
let func = 0
|
|
let inQuote = false
|
|
let prevQuote = ''
|
|
let escape = false
|
|
|
|
for (let letter of string) {
|
|
if (escape) {
|
|
escape = false
|
|
} else if (letter === '\\') {
|
|
escape = true
|
|
} else if (inQuote) {
|
|
if (letter === prevQuote) {
|
|
inQuote = false
|
|
}
|
|
} else if (letter === '"' || letter === "'") {
|
|
inQuote = true
|
|
prevQuote = letter
|
|
} else if (letter === '(') {
|
|
func += 1
|
|
} else if (letter === ')') {
|
|
if (func > 0) func -= 1
|
|
} else if (func === 0) {
|
|
if (separators.includes(letter)) split = true
|
|
}
|
|
|
|
if (split) {
|
|
if (current !== '') array.push(current.trim())
|
|
current = ''
|
|
split = false
|
|
} else {
|
|
current += letter
|
|
}
|
|
}
|
|
|
|
if (last || current !== '') array.push(current.trim())
|
|
return array
|
|
}
|
|
}
|
|
|
|
module.exports = list
|
|
list.default = list
|