2019-05-10 14:34:54 -07:00
|
|
|
export interface FiddleConfiguration {
|
2019-03-19 03:06:13 +01:00
|
|
|
readonly slug: string;
|
2019-05-10 14:34:54 -07:00
|
|
|
readonly version?: number;
|
2019-08-03 23:42:21 +02:00
|
|
|
readonly downloaded: boolean;
|
2019-03-19 03:06:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function parseFiddleId(id: string): FiddleConfiguration {
|
2020-05-29 13:12:13 -07:00
|
|
|
const idFragments = id.split('/');
|
|
|
|
|
const fiddleSlug = idFragments[0];
|
|
|
|
|
const fiddleVersion = idFragments.length > 1 ? parseInt(id.split('/')[1]) : undefined;
|
2019-03-19 03:06:13 +01:00
|
|
|
|
2019-08-03 23:42:21 +02:00
|
|
|
return { slug: fiddleSlug, version: fiddleVersion, downloaded: false };
|
2019-03-19 03:06:13 +01:00
|
|
|
}
|