slash

  • Version 5.1.0
  • Published
  • 3.25 kB
  • No dependencies
  • MIT license

Install

npm i slash
yarn add slash
pnpm add slash

Overview

Convert Windows backslash paths to slash paths

Index

Functions

Functions

function slash

slash: (path: string) => string;
  • Convert Windows backslash paths to slash paths: foo\\barfoo/bar.

    [Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths.

    Parameter path

    A Windows backslash path.

    Returns

    A path with forward slashes.

    Example 1

    import path from 'node:path';
    import slash from 'slash';
    const string = path.join('foo', 'bar');
    // Unix => foo/bar
    // Windows => foo\\bar
    slash(string);
    // Unix => foo/bar
    // Windows => foo/bar

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (3)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/slash.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/slash)
  • HTML
    <a href="https://www.jsdocs.io/package/slash"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>