[Pkg-javascript-commits] [node-filename-regex] 01/06: Import Upstream version 2.0.0
Sruthi Chandran
srud-guest at moszumanska.debian.org
Tue Oct 18 07:28:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
srud-guest pushed a commit to branch master
in repository node-filename-regex.
commit 44420fa7e53fc0009a504c8d275ce2b8904a7120
Author: Sruthi <srud at disroot.org>
Date: Tue Oct 18 12:45:25 2016 +0530
Import Upstream version 2.0.0
---
.editorconfig | 17 +++++++++++++++++
.gitattributes | 14 ++++++++++++++
.gitignore | 12 ++++++++++++
.jshintrc | 18 ++++++++++++++++++
.verb.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++
LICENSE | 21 +++++++++++++++++++++
README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
index.js | 10 ++++++++++
package.json | 41 +++++++++++++++++++++++++++++++++++++++++
test.js | 42 ++++++++++++++++++++++++++++++++++++++++++
10 files changed, 273 insertions(+)
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..192641a
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[test/fixtures/*]
+insert_final_newline = false
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..759c2c5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,14 @@
+# Enforce Unix newlines
+*.* text eol=lf
+*.css text eol=lf
+*.html text eol=lf
+*.js text eol=lf
+*.json text eol=lf
+*.less text eol=lf
+*.md text eol=lf
+*.yml text eol=lf
+
+*.jpg binary
+*.gif binary
+*.png binary
+*.jpeg binary
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..20d5293
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*.sublime-*
+_gh_pages
+actual
+bower_components
+node_modules
+npm-debug.log
+temp
+test/actual
+tmp
+TODO.md
+vendor
+*.DS_Store
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..96d4b14
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,18 @@
+{
+ "asi": false,
+ "boss": true,
+ "curly": true,
+ "eqeqeq": true,
+ "eqnull": true,
+ "esnext": true,
+ "immed": true,
+ "latedef": true,
+ "laxcomma": false,
+ "newcap": true,
+ "noarg": true,
+ "node": true,
+ "sub": true,
+ "undef": true,
+ "unused": true,
+ "mocha": true
+}
\ No newline at end of file
diff --git a/.verb.md b/.verb.md
new file mode 100644
index 0000000..fb995dc
--- /dev/null
+++ b/.verb.md
@@ -0,0 +1,47 @@
+# {%= name %} {%= badge("fury") %}
+
+> {%= description %}
+
+
+{%= include("install-npm", {save: true}) %}
+
+## Usage
+
+```js
+var regex = require('{%= name %}');
+
+'a/b/c/d.min.js'.match(regex());
+//=> match[0] = 'd.min.js'
+
+'a/b/c/.dotfile'.match(regex());
+//=> match[0] = '.dotfile'
+```
+
+
+## Run tests
+
+Install dev dependencies:
+
+```bash
+npm i -d && npm test
+```
+
+## Contributing
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})
+
+
+## Author
+
+**Jon Schlinkert**
+
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+
+## License
+{%= copyright() %}
+{%= license() %}
+
+***
+
+{%= include("footer") %}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..709eeb7
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2015, Jon Schlinkert
+
+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/README.md b/README.md
new file mode 100644
index 0000000..d001e7a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,51 @@
+# filename-regex [![NPM version](https://badge.fury.io/js/filename-regex.svg)](http://badge.fury.io/js/filename-regex)
+
+> Regular expression for matching file names, with or without extension.
+
+
+## Install with [npm](npmjs.org)
+
+```bash
+npm i filename-regex --save
+```
+
+## Usage
+
+```js
+var regex = require('filename-regex');
+
+'a/b/c/d.min.js'.match(regex());
+//=> match[0] = 'd.min.js'
+
+'a/b/c/.dotfile'.match(regex());
+//=> match[0] = '.dotfile'
+```
+
+
+## Run tests
+
+Install dev dependencies:
+
+```bash
+npm i -d && npm test
+```
+
+## Contributing
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/regexps/filename-regex/issues)
+
+
+## Author
+
+**Jon Schlinkert**
+
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+
+## License
+Copyright (c) 2015 Jon Schlinkert
+Released under the MIT license
+
+***
+
+_This file was generated by [verb](https://github.com/assemble/verb) on January 24, 2015._
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..bb1888b
--- /dev/null
+++ b/index.js
@@ -0,0 +1,10 @@
+/*!
+ * filename-regex <https://github.com/regexps/filename-regex>
+ *
+ * Copyright (c) 2014-2015, Jon Schlinkert
+ * Licensed under the MIT license.
+ */
+
+module.exports = function filenameRegex() {
+ return /([^\\\/]+)$/;
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a078400
--- /dev/null
+++ b/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "filename-regex",
+ "description": "Regular expression for matching file names, with or without extension.",
+ "version": "2.0.0",
+ "homepage": "https://github.com/regexps/filename-regex",
+ "author": {
+ "name": "Jon Schlinkert",
+ "url": "https://github.com/jonschlinkert"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/regexps/filename-regex.git"
+ },
+ "bugs": {
+ "url": "https://github.com/regexps/filename-regex/issues"
+ },
+ "license": {
+ "type": "MIT",
+ "url": "https://github.com/regexps/filename-regex/blob/master/LICENSE-MIT"
+ },
+ "main": "index.js",
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "files": ["index.js"],
+ "scripts": {
+ "test": "mocha -R spec"
+ },
+ "keywords": [
+ "basename",
+ "regular expression",
+ "file",
+ "filename",
+ "filepath",
+ "match",
+ "name",
+ "path",
+ "regex",
+ "regexp"
+ ]
+}
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..89db400
--- /dev/null
+++ b/test.js
@@ -0,0 +1,42 @@
+/*!
+ * filename-regex <https://github.com/regexps/filename-regex>
+ *
+ * Copyright (c) 2014-2015, Jon Schlinkert
+ * Licensed under the MIT License
+ */
+
+'use strict';
+
+var assert = require('assert');
+var re = require('./');
+
+function match(str) {
+ var res = str.match(re())
+ return res && res[0];
+}
+
+it('should match the last part of a file path:', function () {
+ assert.equal(match(''), null);
+ assert.equal(match('a'), 'a');
+ assert.equal(match('a/b'), 'b');
+ assert.equal(match('a/b/c/d'), 'd');
+ assert.equal(match('a\\b\\c\\d'), 'd');
+});
+
+it('should match a filename with an extension:', function () {
+ assert.equal(match('abc/xyz.md'), 'xyz.md');
+ assert.equal(match('abc\\xyz.md'), 'xyz.md');
+ assert.equal(match('b.md'), 'b.md');
+});
+
+it('should match a file name that is only a dotfile or file extension:', function () {
+ assert.equal(match('.md'), '.md');
+ assert.equal(match('.dotfile'), '.dotfile');
+ assert.equal(match('abc\\.gitignore'), '.gitignore');
+ assert.equal(match('abc/.gitignore'), '.gitignore');
+});
+
+it('should match the filename when there are dots in the dirname:', function () {
+ assert.equal(match('a/.b/abc.foo.min.js'), 'abc.foo.min.js');
+ assert.equal(match('a/b.c.d/foo.js'), 'foo.js');
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-filename-regex.git
More information about the Pkg-javascript-commits
mailing list