[Pkg-javascript-commits] [node-uri-path] 01/02: Imported Upstream version 1.0.0
Thorsten Alteholz
alteholz at moszumanska.debian.org
Sun Mar 27 15:40:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-uri-path.
commit 945d4ed2d5a7ceba4c759f0ccf28ab98cffe248d
Author: Thorsten Alteholz <debian at alteholz.de>
Date: Sun Mar 27 17:40:28 2016 +0200
Imported Upstream version 1.0.0
---
.npmignore | 2 ++
.travis.yml | 3 +++
CONTRIBUTING.md | 1 +
LICENSE-MIT | 21 +++++++++++++++++++++
LICENSE-WTFPL | 14 ++++++++++++++
README.md | 26 ++++++++++++++++++++++++++
index.js | 5 +++++
package.json | 38 ++++++++++++++++++++++++++++++++++++++
test/main.js | 17 +++++++++++++++++
9 files changed, 127 insertions(+)
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..0c0aa04
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,2 @@
+/node_modules/
+/npm-debug.log
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..6e5919d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "0.10"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..680d25e
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1 @@
+See [Ult Foundation Contributor's Guide](https://github.com/UltFoundation/Ultiomatic.js/blob/master/CONTRIBUTING.md).
diff --git a/LICENSE-MIT b/LICENSE-MIT
new file mode 100644
index 0000000..ff6b7f1
--- /dev/null
+++ b/LICENSE-MIT
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Fabrício Matté
+
+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.
diff --git a/LICENSE-WTFPL b/LICENSE-WTFPL
new file mode 100644
index 0000000..ee7d6a5
--- /dev/null
+++ b/LICENSE-WTFPL
@@ -0,0 +1,14 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam at hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b09268c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,26 @@
+# uri-path
+[![NPM version](https://badge.fury.io/js/uri-path.png)](https://npmjs.org/package/uri-path)
+[![Build Status](https://travis-ci.org/UltCombo/uri-path.png?branch=master)](https://travis-ci.org/UltCombo/uri-path)
+[![devDependency Status](https://david-dm.org/UltCombo/uri-path/dev-status.png)](https://david-dm.org/UltCombo/uri-path#info=devDependencies)
+
+Convert relative file system paths into safe URI paths
+
+# Install
+
+```
+npm install --save uri-path
+```
+
+# Usage
+
+```js
+var URIpath = require('uri-path');
+
+// Properly encode URI path segments
+URIpath('../abc/@#$%¨&()[]{}-_=+ß/môòñ 月 قمر');
+// -> '../abc/%40%23%24%25%C2%A8%26()%5B%5D%7B%7D-_%3D%2B%C3%9F/m%C3%B4%C3%B2%C3%B1%20%E6%9C%88%20%D9%82%D9%85%D8%B1'
+
+// Also supports paths with Windows directory separators
+URIpath('a\\b\\c');
+// -> 'a/b/c'
+```
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..e9d21ca
--- /dev/null
+++ b/index.js
@@ -0,0 +1,5 @@
+'use strict';
+
+module.exports = function(path) {
+ return path.split(/[\\\/]/g).map(encodeURIComponent).join('/');
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..1a7f949
--- /dev/null
+++ b/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "uri-path",
+ "version": "1.0.0",
+ "description": "Convert relative file system paths into safe URI paths",
+ "main": "index.js",
+ "scripts": {
+ "test": "mocha"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/UltCombo/uri-path.git"
+ },
+ "keywords": [
+ "uri",
+ "url",
+ "relative",
+ "file system",
+ "fs",
+ "path",
+ "convert"
+ ],
+ "author": {
+ "name": "Ult Combo",
+ "email": "ultcombo at gmail.com"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "license": "WTFPL OR MIT",
+ "bugs": {
+ "url": "https://github.com/UltCombo/uri-path/issues"
+ },
+ "homepage": "https://github.com/UltCombo/uri-path",
+ "devDependencies": {
+ "mocha": "^2.3.3",
+ "should": "^7.1.1"
+ }
+}
diff --git a/test/main.js b/test/main.js
new file mode 100644
index 0000000..3e8cfba
--- /dev/null
+++ b/test/main.js
@@ -0,0 +1,17 @@
+'use strict';
+
+var URIpath = require('..');
+require('should');
+
+describe('uri-path', function() {
+ it('should convert relative file system paths into properly encoded URIs', function() {
+ var paths = {
+ // file system path: expected URI path
+ '../abc/@#$%¨&()[]{}-_=+ß/môòñ 月 قمر': '../abc/%40%23%24%25%C2%A8%26()%5B%5D%7B%7D-_%3D%2B%C3%9F/m%C3%B4%C3%B2%C3%B1%20%E6%9C%88%20%D9%82%D9%85%D8%B1',
+ 'a\\b\\c': 'a/b/c',
+ };
+ Object.keys(paths).forEach(function(filePath) {
+ URIpath(filePath).should.equal(paths[filePath]);
+ });
+ });
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-uri-path.git
More information about the Pkg-javascript-commits
mailing list