[Pkg-javascript-commits] [node-junk] 01/03: Imported Upstream version 1.0.1
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sun Mar 1 14:09:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository node-junk.
commit 58ed8665075cecec0e728ada8209dfafa930e806
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sun Mar 1 14:47:46 2015 +0100
Imported Upstream version 1.0.1
---
.editorconfig | 15 +++++++++++++++
.gitattributes | 1 +
.gitignore | 1 +
.jshintrc | 13 +++++++++++++
.travis.yml | 6 ++++++
index.js | 30 ++++++++++++++++++++++++++++++
license | 21 +++++++++++++++++++++
package.json | 36 ++++++++++++++++++++++++++++++++++++
readme.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++
test.js | 30 ++++++++++++++++++++++++++++++
10 files changed, 199 insertions(+)
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..86c8f59
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+root = 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
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
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/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..804f8af
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,13 @@
+{
+ "node": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "immed": true,
+ "newcap": true,
+ "noarg": true,
+ "undef": true,
+ "unused": "vars",
+ "strict": true
+}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..dedfc07
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,6 @@
+sudo: false
+language: node_js
+node_js:
+ - 'iojs'
+ - '0.12'
+ - '0.10'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..b38149b
--- /dev/null
+++ b/index.js
@@ -0,0 +1,30 @@
+'use strict';
+
+// // All
+// /^npm-debug\.log$/, // npm error log
+// /^\..*\.swp$/, // vim state
+// // OS X
+// /^\.DS_Store$/, // stores custom folder attributes
+// /^\.AppleDouble$/, // stores additional file resources
+// /^\.LSOverride$/, // contains the absolute path to the app to be used
+// /^Icon[\r\?]?/, // custom Finder icon
+// /^\._.*/, // thumbnail
+// /^.Spotlight-V100$/, // file that might appear on external disk
+// /\.Trashes/, // file that might appear on external disk
+// /^__MACOSX$/, // resource fork
+// // Linux
+// /~$/, // backup file
+// // Windows
+// /^Thumbs\.db$/, // image file cache
+// /^ehthumbs\.db$/, // folder config file
+// /^Desktop\.ini$/ // stores custom folder attributes
+
+exports.re = /^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon[\r\?]?|^\._.*|^.Spotlight-V100$|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^Desktop\.ini$/;
+
+exports.is = function (filename) {
+ return exports.re.test(filename);
+};
+
+exports.not = exports.isnt = function (filename) {
+ return !exports.is(filename);
+};
diff --git a/license b/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus at gmail.com> (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.
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..d8dec0c
--- /dev/null
+++ b/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "junk",
+ "version": "1.0.1",
+ "description": "Filter out OS junk files like .DS_Store and Thumbs.db",
+ "license": "MIT",
+ "repository": "sindresorhus/junk",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus at gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "node test.js"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "junk",
+ "trash",
+ "garbage",
+ "files",
+ "os",
+ "ignore",
+ "exclude",
+ "filter",
+ "temp",
+ "tmp"
+ ],
+ "devDependencies": {
+ "ava": "0.0.3"
+ }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..bce6fc5
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,46 @@
+# junk [![Build Status](https://travis-ci.org/sindresorhus/junk.svg?branch=master)](https://travis-ci.org/sindresorhus/junk)
+
+> Filter out [OS junk files](test.js) like `.DS_Store` and `Thumbs.db`
+
+
+## Install
+
+```sh
+$ npm install --save junk
+```
+
+
+## Usage
+
+```js
+var fs = require('fs');
+var junk = require('junk');
+
+fs.readdir('path', function (err, files) {
+ console.log(files);
+ //=> ['.DS_Store', 'test.jpg']
+
+ console.log(files.filter(junk.not));
+ //=> ['test.jpg']
+});
+```
+
+
+## API
+
+### junk.is(filename)
+
+Returns true if `filename` matches a junk file.
+
+### junk.not(filename)
+
+Returns true if `filename` doesn't match a junk file.
+
+### junk.re
+
+The regex used for matching.
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..6bcd354
--- /dev/null
+++ b/test.js
@@ -0,0 +1,30 @@
+'use strict';
+var test = require('ava');
+var junk = require('./');
+
+var fixture = [
+ '.DS_Store',
+ '.AppleDouble',
+ '.LSOverride',
+ 'Icon',
+ '._test',
+ '.Spotlight-V100',
+ '.Trashes',
+ '__MACOSX',
+ 'test~',
+ 'Thumbs.db',
+ 'ehthumbs.db',
+ 'Desktop.ini',
+ 'npm-debug.log',
+ '.test.swp'
+];
+
+test('should match junk files', function (t) {
+ fixture.forEach(function (el) {
+ t.assert(junk.is(el));
+ });
+});
+
+test('should not match non-junk files', function (t) {
+ t.assert(junk.not('test'));
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-junk.git
More information about the Pkg-javascript-commits
mailing list