]>
Commit | Line | Data |
---|---|---|
7e98a7df C |
1 | function getAPId (object: string | { id: string }) { |
2 | if (typeof object === 'string') return object | |
3 | ||
4 | return object.id | |
5 | } | |
6 | ||
b2111066 C |
7 | function getActivityStreamDuration (duration: number) { |
8 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration | |
9 | return 'PT' + duration + 'S' | |
10 | } | |
11 | ||
12 | function getDurationFromActivityStream (duration: string) { | |
13 | return parseInt(duration.replace(/[^\d]+/, '')) | |
14 | } | |
15 | ||
7e98a7df | 16 | export { |
b2111066 C |
17 | getAPId, |
18 | getActivityStreamDuration, | |
19 | getDurationFromActivityStream | |
7e98a7df | 20 | } |