UNPKG

fs-iterator

Version:

A file system iterator with filter and asyncIterator iterafaces. Supports Node 0.10 and above

19 lines (18 loc) 525 B
import { sep } from 'path'; function join(left, right) { if (!left) return right || ''; if (!right) return left; return left + sep + right; } export default function createEntry(iterator, item) { const basename = item.basename.name ? item.basename.name : item.basename; const stats = item.basename.name ? item.basename : null; const path = join(item.path, basename); const fullPath = join(iterator.root, path); return { basename, stats, path, fullPath }; }