parent
ade7e62836
commit
e8948452fd
|
@ -4,10 +4,7 @@ const { JSDOM } = jsdom;
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import { INote } from '../models/note';
|
import { INote } from '../models/note';
|
||||||
import { TextElement } from './parse';
|
import { TextElement } from './parse';
|
||||||
|
import { intersperse } from '../prelude/array';
|
||||||
function intersperse<T>(sep: T, xs: T[]): T[] {
|
|
||||||
return [].concat(...xs.map(x => [sep, x])).slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlers: { [key: string]: (window: any, token: any, mentionedRemoteUsers: INote['mentionedRemoteUsers']) => void } = {
|
const handlers: { [key: string]: (window: any, token: any, mentionedRemoteUsers: INote['mentionedRemoteUsers']) => void } = {
|
||||||
bold({ document }, { bold }) {
|
bold({ document }, { bold }) {
|
||||||
|
|
|
@ -5,3 +5,7 @@ export function countIf<T>(f: (x: T) => boolean, xs: T[]): number {
|
||||||
export function count<T>(x: T, xs: T[]): number {
|
export function count<T>(x: T, xs: T[]): number {
|
||||||
return countIf(y => x === y, xs);
|
return countIf(y => x === y, xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function intersperse<T>(sep: T, xs: T[]): T[] {
|
||||||
|
return [].concat(...xs.map(x => [sep, x])).slice(1);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue