Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/globber/src/junk.ts>isNotJunk

Include and excludes files and directories from a deep search of the provided root directory
Latest
function isNotJunk
import { isNotJunk } from "https://deno.land/x/globber@0.1.0/src/junk.ts";

Returns true if filename does not match a junk file.

Taken from https://github.com/sindresorhus/junk

Examples

This be used to find all junk files in a directory.

import { isNotJunk } from 'https://deno.land/x/globber/mod.ts';

const files: string[] = []
const notJunk: string[] = [];

for await (const file of Deno.readDir('some/path')) {
  files.push(file.name);

  if (isNotJunk(file.name)) {
    notJunk.push(file.name);
  }
}

console.log(notJunk);
//=> ['test.jpg']

console.log(files);
//=> ['test.jpg', '.DS_Store']

Parameters

filename: string