[Pkg-javascript-commits] [node-strict-uri-encode] 01/04: Import Upstream version 2.0.0
Shirish Togarla
shirish12-guest at moszumanska.debian.org
Tue Feb 7 19:32:02 UTC 2017
This is an automated email from the git hooks/post-receive script.
shirish12-guest pushed a commit to branch master
in repository node-strict-uri-encode.
commit af69321b9dded3375498672f91caec69a50c2343
Author: Shirish Togarla <shirishtogarla533 at gmail.com>
Date: Tue Feb 7 19:11:57 2017 +0000
Import Upstream version 2.0.0
---
.editorconfig | 12 ++++++++++++
.gitattributes | 2 ++
.gitignore | 1 +
.travis.yml | 4 ++++
index.js | 2 ++
license | 21 +++++++++++++++++++++
package.json | 31 +++++++++++++++++++++++++++++++
readme.md | 39 +++++++++++++++++++++++++++++++++++++++
test.js | 9 +++++++++
9 files changed, 121 insertions(+)
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..98a761d
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..391f0a4
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+* text=auto
+*.js text eol=lf
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..97519af
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - '6'
+ - '4'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..affabef
--- /dev/null
+++ b/index.js
@@ -0,0 +1,2 @@
+'use strict';
+module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
diff --git a/license b/license
new file mode 100644
index 0000000..0f8cf79
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Kevin Martensson <kevinmartensson at gmail.com> (github.com/kevva)
+
+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/package.json b/package.json
new file mode 100644
index 0000000..565fb63
--- /dev/null
+++ b/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "strict-uri-encode",
+ "version": "2.0.0",
+ "description": "A stricter URI encode adhering to RFC 3986",
+ "license": "MIT",
+ "repository": "kevva/strict-uri-encode",
+ "author": {
+ "name": "Kevin Mårtensson",
+ "email": "kevinmartensson at gmail.com",
+ "url": "github.com/kevva"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "component",
+ "encode",
+ "RFC3986",
+ "uri"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..05e3fee
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,39 @@
+# strict-uri-encode [![Build Status](https://travis-ci.org/kevva/strict-uri-encode.svg?branch=master)](https://travis-ci.org/kevva/strict-uri-encode)
+
+> A stricter URI encode adhering to [RFC 3986](http://tools.ietf.org/html/rfc3986)
+
+
+## Install
+
+```
+$ npm install --save strict-uri-encode
+```
+
+
+## Usage
+
+```js
+const strictUriEncode = require('strict-uri-encode');
+
+strictUriEncode('unicorn!foobar');
+//=> 'unicorn%21foobar'
+
+strictUriEncode('unicorn*foobar');
+//=> 'unicorn%2Afoobar'
+```
+
+
+## API
+
+### strictUriEncode(string)
+
+#### string
+
+Type: `string`, `number`
+
+String to URI encode.
+
+
+## License
+
+MIT © [Kevin Mårtensson](http://github.com/kevva)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..4e3aa20
--- /dev/null
+++ b/test.js
@@ -0,0 +1,9 @@
+import test from 'ava';
+import m from './';
+
+test(t => {
+ t.is(m('unicorn!foobar'), 'unicorn%21foobar');
+ t.is(m('unicorn\'foobar'), 'unicorn%27foobar');
+ t.is(m('unicorn*foobar'), 'unicorn%2Afoobar');
+ t.not(m('unicorn*foobar'), encodeURIComponent('unicorn*foobar'));
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-strict-uri-encode.git
More information about the Pkg-javascript-commits
mailing list