utilitas 1999.1.29 → 1999.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.29",
4
+ "version": "1999.1.31",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/utilitas.mjs CHANGED
@@ -552,8 +552,8 @@ const renderCode = (code, options) => {
552
552
  x => `${String(i++).padStart(bits, '0')} ${s} ${ensureString(x).replace('```', '\\`\\`\\`')}`
553
553
  );
554
554
  const output = (
555
- options?.md ? `\`\`\`${options.md === true ? '' : options.md}\n` : ''
556
- ) + (options?.asArray ? resp : resp.join('\n')) + (options.md ? '\n```' : '');
555
+ options?.md ? `\`\`\`${options?.md === true ? '' : options?.md}\n` : ''
556
+ ) + (options?.asArray ? resp : resp.join('\n')) + (options?.md ? '\n```' : '');
557
557
  options?.log && console.log(output);
558
558
  return output;
559
559
  };
package/lib/web.mjs CHANGED
@@ -326,18 +326,13 @@ const initDistill = async (options = {}) => {
326
326
  };
327
327
 
328
328
  const distill = async (url, options = {}) => {
329
- if (ensureString(options.provider, { case: 'UP' }) === 'JINA') {
330
- const key = options.apiKey || jinaApiKey;
331
- assert(key, 'Jina API key is required.');
332
- var url = `https://r.jina.ai/${encodeURIComponent(url)}`;
333
- var resp = await get(url, {
329
+ const key = options.apiKey || jinaApiKey;
330
+ if (key) {
331
+ const resp = await get(`https://r.jina.ai/${encodeURIComponent(url)}`, {
334
332
  fetch: { headers: { 'Authorization': `Bearer ${key}` } },
335
333
  ...options || {},
336
334
  });
337
- return {
338
- content: null,
339
- summary: resp?.content
340
- };
335
+ return { content: null, summary: resp?.content };
341
336
  }
342
337
  let content;
343
338
  if (isYoutubeUrl(url)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.29",
4
+ "version": "1999.1.31",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",