@sphido/core 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/lib/get-pages.js +5 -5
  2. package/package.json +2 -2
package/lib/get-pages.js CHANGED
@@ -1,27 +1,27 @@
1
1
  import {join, parse} from 'node:path';
2
2
  import {readdir} from 'node:fs/promises';
3
- import {isPage as isPageDefault} from './is-page.js';
3
+ import {isPage} from './is-page.js';
4
4
 
5
5
  /**
6
6
  * Retrieve an array tree of pages from path
7
7
  * @param {string} path
8
- * @param {Function} isPage
8
+ * @param {Function} include
9
9
  * @param extenders
10
10
  * @returns {Promise<Awaited<unknown>[{name, path}]>}
11
11
  */
12
- export async function getPages({path = 'content', isPage = isPageDefault} = {}, ...extenders) {
12
+ export async function getPages({path = 'content', include = isPage} = {}, ...extenders) {
13
13
  const dir = await readdir(path, {withFileTypes: true});
14
14
 
15
15
  return Promise.all(
16
16
  dir
17
- .filter(dirent => isPage(dirent))
17
+ .filter(dirent => include(dirent))
18
18
  .map(async dirent => {
19
19
  // Page
20
20
  const page = {name: parse(dirent.name).name, path: join(path, dirent.name)};
21
21
 
22
22
  // Read subdirectory recursively
23
23
  if (dirent.isDirectory()) {
24
- page.children = await getPages({path: page.path, isPage}, ...extenders);
24
+ page.children = await getPages({path: page.path, isPage: include}, ...extenders);
25
25
  }
26
26
 
27
27
  // Calling callbacks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphido/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "author": {
5
5
  "name": "Roman Ožana",
6
6
  "email": "roman@ozana.cz",
@@ -40,5 +40,5 @@
40
40
  "scripts": {
41
41
  "test": "ava"
42
42
  },
43
- "gitHead": "d040ed1e915c034652a75003a246e985de05d2ec"
43
+ "gitHead": "75cf4126bc6027237f192873c51c0d636aacd0ab"
44
44
  }