UNPKG

book-length

Version:

✰ Returns the number of pages on your book (Bookiza Project). ✰

13 lines (10 loc) 298 B
import { readdirSync } from 'fs'; export default function bookLength() { const pages = (source) => readdirSync(source, { withFileTypes: true, }).reduce((a, c) => { c.isDirectory() && a.push(c.name); return a; }, []); return pages('./manuscript').length; }