pax_global_header00006660000000000000000000000064123726353640014525gustar00rootroot0000000000000052 comment=c801dd4568ad9380b534067eabe88942394f82ff slash-1.0.0/000077500000000000000000000000001237263536400126355ustar00rootroot00000000000000slash-1.0.0/.editorconfig000066400000000000000000000003371237263536400153150ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [package.json] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false slash-1.0.0/.gitattributes000066400000000000000000000000141237263536400155230ustar00rootroot00000000000000* text=auto slash-1.0.0/.gitignore000066400000000000000000000000151237263536400146210ustar00rootroot00000000000000node_modules slash-1.0.0/.jshintrc000066400000000000000000000002761237263536400144670ustar00rootroot00000000000000{ "node": true, "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "immed": true, "newcap": true, "noarg": true, "undef": true, "unused": "vars", "strict": true } slash-1.0.0/.travis.yml000066400000000000000000000000461237263536400147460ustar00rootroot00000000000000language: node_js node_js: - '0.10' slash-1.0.0/index.js000066400000000000000000000003641237263536400143050ustar00rootroot00000000000000'use strict'; module.exports = function (str) { var isExtendedLengthPath = /^\\\\\?\\/.test(str); var hasNonAscii = /[^\x00-\x80]+/.test(str); if (isExtendedLengthPath || hasNonAscii) { return str; } return str.replace(/\\/g, '/'); }; slash-1.0.0/license000066400000000000000000000021371237263536400142050ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (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-1.0.0/package.json000066400000000000000000000010721237263536400151230ustar00rootroot00000000000000{ "name": "slash", "version": "1.0.0", "description": "Convert Windows backslash paths to slash paths", "keywords": [ "path", "seperator", "sep", "slash", "backslash", "windows", "win" ], "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "http://sindresorhus.com" }, "repository": "sindresorhus/slash", "scripts": { "test": "mocha" }, "devDependencies": { "mocha": "*" }, "engines": { "node": ">=0.10.0" }, "license": "MIT", "files": [ "index.js" ] } slash-1.0.0/readme.md000066400000000000000000000015721237263536400144210ustar00rootroot00000000000000# slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/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 outputs `\\` paths on Windows. ## Install ```sh $ npm install --save slash ``` ## Usage ```js var path = require('path'); var slash = require('slash'); var str = path.join('foo', 'bar'); // Unix => foo/bar // Windows => foo\\bar slash(str); // Unix => foo/bar // Windows => foo/bar ``` ## API ### slash(path) Type: `string` Accepts a Windows backslash path and returns a slash path. ## License MIT © [Sindre Sorhus](http://sindresorhus.com) slash-1.0.0/test.js000066400000000000000000000011141237263536400141470ustar00rootroot00000000000000'use strict'; var assert = require('assert'); var slash = require('./'); describe('slash()', function () { it('should convert backwards-slash paths to forward slash paths', function () { assert.equal(slash('c:/aaaa\\bbbb'), 'c:/aaaa/bbbb'); assert.equal(slash('c:\\aaaa\\bbbb'), 'c:/aaaa/bbbb'); }); it('should not convert extended-length paths', function () { var path = '\\\\?\\c:\\aaaa\\bbbb'; assert.equal(slash(path), path); }); it('should not convert paths with Unicode', function () { var path = 'c:\\aaaa\\bbbb\\★'; assert.equal(slash(path), path); }); });