Options
All
  • Public
  • Public/Protected
  • All
Menu

GHOSTs Tools

This package is simply a collection of functions (tools) that I use often, I plan on adding to this package often and heavily sticking to semver (as you should).

Full Documentaiton

Documentation can be viewed here - If docs seem out of date use ctrl + f5 to "hard refresh"

Example use

import { removeKeys } from 'ghoststools'; // You can view all exported members on the docs

const inputObject = { test: true, run: () => {} };
const options = removeKeys(inputObject, 'run');

Index

Functions

Const castToArray

  • castToArray<T>(item: T | T[]): T[]
  • Cast a item to a array of that item

    Type parameters

    • T

    Parameters

    • item: T | T[]

    Returns T[]

Const flattenPaths

  • flattenPaths(input: string | string[]): string[]
  • Takes in path(s) and flattens down to a single array of files (turning directories into paths)

    Parameters

    • input: string | string[]

    Returns string[]

Const posixify

  • posixify(path: string): string
  • Normalises all paths to posix style

    Parameters

    • path: string

    Returns string

Const readdirRecursive

  • readdirRecursive(path: string): string[]
  • Get all files within a directory recursively (includes sub directories)

    Parameters

    • path: string

    Returns string[]

Const removeKeys

  • removeKeys(object: object, keys: string | string[]): object
  • Removes all the keys from a given object and returns it (doesn't mutate the given object)

    Parameters

    • object: object
    • keys: string | string[]

    Returns object

Const stripTrailingSlash

  • stripTrailingSlash(path: string): string
  • Removes the trailing slash on a path - removes both \ and /

    Parameters

    • path: string

    Returns string

Legend

Generated using TypeDoc