pax_global_header00006660000000000000000000000064140355122700014511gustar00rootroot0000000000000052 comment=b5cdd12272f94cfc37c01ac9c2b4e22973e258e5 slash-4.0.0/000077500000000000000000000000001403551227000126245ustar00rootroot00000000000000slash-4.0.0/.editorconfig000066400000000000000000000002571403551227000153050ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 slash-4.0.0/.gitattributes000066400000000000000000000000231403551227000155120ustar00rootroot00000000000000* text=auto eol=lf slash-4.0.0/.github/000077500000000000000000000000001403551227000141645ustar00rootroot00000000000000slash-4.0.0/.github/funding.yml000066400000000000000000000001571403551227000163440ustar00rootroot00000000000000github: sindresorhus open_collective: sindresorhus tidelift: npm/slash custom: https://sindresorhus.com/donate slash-4.0.0/.github/security.md000066400000000000000000000002631403551227000163560ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. slash-4.0.0/.github/workflows/000077500000000000000000000000001403551227000162215ustar00rootroot00000000000000slash-4.0.0/.github/workflows/main.yml000066400000000000000000000006451403551227000176750ustar00rootroot00000000000000name: CI on: - push - pull_request jobs: test: name: Node.js ${{ matrix.node-version }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: - 14 - 12 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test slash-4.0.0/.gitignore000066400000000000000000000000271403551227000146130ustar00rootroot00000000000000node_modules yarn.lock slash-4.0.0/.npmrc000066400000000000000000000000231403551227000137370ustar00rootroot00000000000000package-lock=false slash-4.0.0/index.d.ts000066400000000000000000000011301403551227000145200ustar00rootroot00000000000000/** Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`. [Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. @param path - A Windows backslash path. @returns A path with forward slashes. @example ``` import path from '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 ``` */ export default function slash(path: string): string; slash-4.0.0/index.js000066400000000000000000000004351403551227000142730ustar00rootroot00000000000000export default function slash(path) { const isExtendedLengthPath = /^\\\\\?\\/.test(path); const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex if (isExtendedLengthPath || hasNonAscii) { return path; } return path.replace(/\\/g, '/'); } slash-4.0.0/index.test-d.ts000066400000000000000000000001501403551227000154760ustar00rootroot00000000000000import {expectType} from 'tsd'; import slash from './index.js'; expectType(slash('foo\\bar')); slash-4.0.0/license000066400000000000000000000021351403551227000141720ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. slash-4.0.0/package.json000066400000000000000000000012601403551227000151110ustar00rootroot00000000000000{ "name": "slash", "version": "4.0.0", "description": "Convert Windows backslash paths to slash paths", "license": "MIT", "repository": "sindresorhus/slash", "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, "type": "module", "exports": "./index.js", "engines": { "node": ">=12" }, "scripts": { "test": "xo && ava && tsd" }, "files": [ "index.js", "index.d.ts" ], "keywords": [ "path", "seperator", "slash", "backslash", "windows", "convert" ], "devDependencies": { "ava": "^3.15.0", "tsd": "^0.14.0", "xo": "^0.38.2" } } slash-4.0.0/readme.md000066400000000000000000000021701403551227000144030ustar00rootroot00000000000000# slash > Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar` [Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. This was created since the `path` methods in Node.js outputs `\\` paths on Windows. ## Install ``` $ npm install slash ``` ## Usage ```js import path from '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 ``` ## API ### slash(path) Type: `string` Accepts a Windows backslash path and returns a path with forward slashes. ---
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
slash-4.0.0/test.js000066400000000000000000000007111403551227000141400ustar00rootroot00000000000000import test from 'ava'; import slash from './index.js'; test('convert backwards-slash paths to forward slash paths', t => { t.is(slash('c:/aaaa\\bbbb'), 'c:/aaaa/bbbb'); t.is(slash('c:\\aaaa\\bbbb'), 'c:/aaaa/bbbb'); }); test('not convert extended-length paths', t => { const path = '\\\\?\\c:\\aaaa\\bbbb'; t.is(slash(path), path); }); test('not convert paths with Unicode', t => { const path = 'c:\\aaaa\\bbbb\\★'; t.is(slash(path), path); });