fix: samples function did not work in tests
This commit is contained in:
parent
da8e00eb4e
commit
866277510e
2 changed files with 142 additions and 0 deletions
|
|
@ -108,6 +108,10 @@ export const samples = async (sampleMap, baseUrl = sampleMap._base || '') => {
|
|||
const [_, path] = sampleMap.split('github:');
|
||||
sampleMap = `https://raw.githubusercontent.com/${path}/strudel.json`;
|
||||
}
|
||||
if (typeof fetch !== 'function') {
|
||||
// not a browser
|
||||
return;
|
||||
}
|
||||
const base = sampleMap.split('/').slice(0, -1).join('/');
|
||||
return fetch(sampleMap)
|
||||
.then((res) => res.json())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue