[Pkg-javascript-commits] [node-is-dotfile] 01/06: Import Upstream version 1.0.2

Sruthi Chandran srud-guest at moszumanska.debian.org
Tue Oct 18 10:03:13 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-is-dotfile.

commit 4c59000ce198a5b0fb122d687f0a0e98da699042
Author: Sruthi <srud at disroot.org>
Date:   Tue Oct 18 15:22:57 2016 +0530

    Import Upstream version 1.0.2
---
 .editorconfig                  | 17 ++++++++++
 .gitattributes                 | 14 ++++++++
 .gitignore                     | 11 +++++++
 .jshintrc                      | 18 ++++++++++
 .verb.md                       | 54 ++++++++++++++++++++++++++++++
 LICENSE                        | 21 ++++++++++++
 README.md                      | 74 ++++++++++++++++++++++++++++++++++++++++++
 benchmark/.gitignore           |  1 +
 benchmark/code/index-of.js     |  9 +++++
 benchmark/code/regex.js        |  6 ++++
 benchmark/fixtures/is.js       |  1 +
 benchmark/fixtures/long-not.js |  1 +
 benchmark/fixtures/long.js     |  1 +
 benchmark/fixtures/not.js      |  1 +
 benchmark/fixtures/start.js    |  1 +
 benchmark/index.js             | 12 +++++++
 index.js                       | 15 +++++++++
 package.json                   | 53 ++++++++++++++++++++++++++++++
 test.js                        | 29 +++++++++++++++++
 19 files changed, 339 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..1ffbc24
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+*.sublime-*
+_gh_pages
+actual
+bower_components
+node_modules
+npm-debug.log
+temp
+test/actual
+tmp
+TODO.md
+vendor
\ No newline at end of file
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..861c59e
--- /dev/null
+++ b/.verb.md
@@ -0,0 +1,54 @@
+# {%= name %} {%= badge("fury") %}
+
+> {%= description %}
+
+## Install
+{%= include("install-npm", {save: true}) %}
+
+## Usage
+
+```js
+var isDotfile = require('{%= name %}');
+```
+
+**false**
+
+All of the following return `false`:
+
+```js
+isDotfile('a/b/c.js');
+isDotfile('/.git/foo');
+isDotfile('a/b/c/.git/foo');
+//=> false
+```
+
+**true**
+
+All of the following return `true`:
+
+```js
+isDotfile('a/b/.gitignore');
+isDotfile('.gitignore');
+isDotfile('/.gitignore');
+//=> true
+```
+
+## Related projects
+{%= related(verb.related.list) %}
+
+## Running tests
+{%= include("tests") %}
+
+## Contributing
+{%= include("contributing") %}
+
+## Authors
+{%= include("author") %}
+
+## License
+{%= copyright() %}
+{%= license() %}
+
+***
+
+{%= include("footer") %}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..33754da
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 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..d17b55c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,74 @@
+# is-dotfile [![NPM version](https://badge.fury.io/js/is-dotfile.svg)](http://badge.fury.io/js/is-dotfile)
+
+> Return true if a file path is (or has) a dotfile. Returns false if the path is a dot directory.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/)
+
+```sh
+$ npm i is-dotfile --save
+```
+
+## Usage
+
+```js
+var isDotfile = require('is-dotfile');
+```
+
+**false**
+
+All of the following return `false`:
+
+```js
+isDotfile('a/b/c.js');
+isDotfile('/.git/foo');
+isDotfile('a/b/c/.git/foo');
+//=> false
+```
+
+**true**
+
+All of the following return `true`:
+
+```js
+isDotfile('a/b/.gitignore');
+isDotfile('.gitignore');
+isDotfile('/.gitignore');
+//=> true
+```
+
+## Related projects
+
+* [dotfile-regex](https://www.npmjs.com/package/dotfile-regex): Regular expresson for matching dotfiles. | [homepage](https://github.com/regexps/dotfile-regex)
+* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob)
+* [is-dotdir](https://www.npmjs.com/package/is-dotdir): Returns true if a path is a dot-directory. | [homepage](https://github.com/jonschlinkert/is-dotdir)
+* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
+
+## Running tests
+
+Install dev dependencies:
+
+```sh
+$ 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/jonschlinkert/is-dotfile/issues/new).
+
+## Authors
+
+**Jon Schlinkert**
+
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+## License
+
+Copyright © 2015 Jon Schlinkert
+Released under the MIT license.
+
+***
+
+_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 20, 2015._
\ No newline at end of file
diff --git a/benchmark/.gitignore b/benchmark/.gitignore
new file mode 100644
index 0000000..5509140
--- /dev/null
+++ b/benchmark/.gitignore
@@ -0,0 +1 @@
+*.DS_Store
diff --git a/benchmark/code/index-of.js b/benchmark/code/index-of.js
new file mode 100644
index 0000000..c8388bc
--- /dev/null
+++ b/benchmark/code/index-of.js
@@ -0,0 +1,9 @@
+
+module.exports = function(str) {
+  if (str.charCodeAt(0) === 46 /* . */ && str.indexOf('/', 1) === -1) {
+    return true;
+  }
+
+  var last = str.lastIndexOf('/');
+  return last !== -1 ? str.charCodeAt(last + 1) === 46  /* . */ : false;
+};
diff --git a/benchmark/code/regex.js b/benchmark/code/regex.js
new file mode 100755
index 0000000..4598fa1
--- /dev/null
+++ b/benchmark/code/regex.js
@@ -0,0 +1,6 @@
+
+var dotfileRe = require('dotfile-regex');
+
+module.exports = function isDotfile(fp) {
+  return dotfileRe().test(fp);
+};
diff --git a/benchmark/fixtures/is.js b/benchmark/fixtures/is.js
new file mode 100755
index 0000000..1e05d8d
--- /dev/null
+++ b/benchmark/fixtures/is.js
@@ -0,0 +1 @@
+module.exports = ['a/b/c/d/.gitignore'];
\ No newline at end of file
diff --git a/benchmark/fixtures/long-not.js b/benchmark/fixtures/long-not.js
new file mode 100644
index 0000000..5c4bb09
--- /dev/null
+++ b/benchmark/fixtures/long-not.js
@@ -0,0 +1 @@
+module.exports = ['a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/foo.gitignore'];
\ No newline at end of file
diff --git a/benchmark/fixtures/long.js b/benchmark/fixtures/long.js
new file mode 100644
index 0000000..1b4ec88
--- /dev/null
+++ b/benchmark/fixtures/long.js
@@ -0,0 +1 @@
+module.exports = ['a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/a/b/c/d/.gitignore'];
\ No newline at end of file
diff --git a/benchmark/fixtures/not.js b/benchmark/fixtures/not.js
new file mode 100755
index 0000000..0a78b02
--- /dev/null
+++ b/benchmark/fixtures/not.js
@@ -0,0 +1 @@
+module.exports = ['a/b/c/d/e.js'];
\ No newline at end of file
diff --git a/benchmark/fixtures/start.js b/benchmark/fixtures/start.js
new file mode 100644
index 0000000..e9c18f0
--- /dev/null
+++ b/benchmark/fixtures/start.js
@@ -0,0 +1 @@
+module.exports = ['.gitignore'];
\ No newline at end of file
diff --git a/benchmark/index.js b/benchmark/index.js
new file mode 100755
index 0000000..dbef223
--- /dev/null
+++ b/benchmark/index.js
@@ -0,0 +1,12 @@
+'use strict';
+
+var Suite = require('benchmarked');
+
+var suite = new Suite({
+  result: true,
+  fixtures: 'fixtures/*.js',
+  add: 'code/*.js',
+  cwd: __dirname
+});
+
+suite.run();
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..5a0a0ca
--- /dev/null
+++ b/index.js
@@ -0,0 +1,15 @@
+/*!
+ * is-dotfile <https://github.com/regexps/is-dotfile>
+ *
+ * Copyright (c) 2015 Jon Schlinkert, contributors.
+ * Licensed under the MIT license.
+ */
+
+module.exports = function(str) {
+  if (str.charCodeAt(0) === 46 /* . */ && str.indexOf('/', 1) === -1) {
+    return true;
+  }
+
+  var last = str.lastIndexOf('/');
+  return last !== -1 ? str.charCodeAt(last + 1) === 46  /* . */ : false;
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..91bde22
--- /dev/null
+++ b/package.json
@@ -0,0 +1,53 @@
+{
+  "name": "is-dotfile",
+  "description": "Return true if a file path is (or has) a dotfile. Returns false if the path is a dot directory.",
+  "version": "1.0.2",
+  "homepage": "https://github.com/jonschlinkert/is-dotfile",
+  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+  "repository": "jonschlinkert/is-dotfile",
+  "bugs": {
+    "url": "https://github.com/jonschlinkert/is-dotfile/issues"
+  },
+  "license": "MIT",
+  "files": [
+    "index.js"
+  ],
+  "main": "index.js",
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "mocha"
+  },
+  "devDependencies": {
+    "benchmarked": "^0.1.3",
+    "dotfile-regex": "^0.1.2",
+    "mocha": "*"
+  },
+  "keywords": [
+    "detect",
+    "dot",
+    "dotfile",
+    "expression",
+    "file",
+    "filepath",
+    "find",
+    "fs",
+    "is",
+    "match",
+    "path",
+    "regex",
+    "regexp",
+    "regular"
+  ],
+  "verb": {
+    "related": {
+      "list": [
+        "has-glob",
+        "is-glob",
+        "dotfile-regex",
+        "is-dotdir"
+      ]
+    }
+  }
+}
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..1abd9c9
--- /dev/null
+++ b/test.js
@@ -0,0 +1,29 @@
+/*!
+ * is-dotfile <https://github.com/regexps/is-dotfile>
+ *
+ * Copyright (c) 2015 Jon Schlinkert.
+ * Licensed under the MIT License
+ */
+
+'use strict';
+
+/* deps: mocha */
+var assert = require('assert');
+var isDotfile = require('./');
+
+it('should return false when the file is not a dotfile', function () {
+  assert.equal(isDotfile('a/b/c/d/e.js'), false);
+  assert.equal(isDotfile('a/b.c.d/e.js'), false);
+  assert.equal(isDotfile('a/b.js'), false);
+  assert.equal(isDotfile('a/.b/c/a.js'), false);
+  assert.equal(isDotfile('.git/foo'), false);
+  assert.equal(isDotfile('.gitignore/foo'), false);
+});
+
+it('should return true when the file is a dotfile', function () {
+  assert.equal(isDotfile('a/b/c/d/.gitignore'), true);
+  assert.equal(isDotfile('a/.b/c/.gitignore'), true);
+  assert.equal(isDotfile('a/.gitignore'), true);
+  assert.equal(isDotfile('.gitignore'), true);
+  assert.equal(isDotfile('/.gitignore'), true);
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-is-dotfile.git



More information about the Pkg-javascript-commits mailing list