mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 04:26:58 +00:00
pull out ILink interface
This commit is contained in:
parent
15baf78ad7
commit
b2c72da96c
1 changed files with 12 additions and 2 deletions
|
@ -35,6 +35,7 @@ export interface IObject {
|
||||||
mediaType?: string;
|
mediaType?: string;
|
||||||
url?: ApObject | string;
|
url?: ApObject | string;
|
||||||
href?: string;
|
href?: string;
|
||||||
|
rel?: string | string[];
|
||||||
tag?: IObject | IObject[];
|
tag?: IObject | IObject[];
|
||||||
sensitive?: boolean;
|
sensitive?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +56,16 @@ export function isAnonymousObject(object: IObject): object is IAnonymousObject {
|
||||||
return object.id === undefined;
|
return object.id === undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ILink extends IObject {
|
||||||
|
'@context'?: string | string[] | Obj | Obj[];
|
||||||
|
type: 'Link' | 'Mention';
|
||||||
|
href: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const isLink = (object: IObject): object is ILink =>
|
||||||
|
(getApType(object) === 'Link' || getApType(object) === 'Link') &&
|
||||||
|
typeof object.href === 'string';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get array of ActivityStreams Objects id
|
* Get array of ActivityStreams Objects id
|
||||||
*/
|
*/
|
||||||
|
@ -307,9 +318,8 @@ export const isPropertyValue = (object: IObject): object is IApPropertyValue =>
|
||||||
'value' in object &&
|
'value' in object &&
|
||||||
typeof object.value === 'string';
|
typeof object.value === 'string';
|
||||||
|
|
||||||
export interface IApMention extends IObject {
|
export interface IApMention extends ILink {
|
||||||
type: 'Mention';
|
type: 'Mention';
|
||||||
href: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue