[Pkg-javascript-commits] [libjs-sifter.js] 01/04: New upstream version 0.5.3+dfsg
Sergio Durigan Junior
sergiodj-guest at moszumanska.debian.org
Sat Dec 9 02:41:11 UTC 2017
This is an automated email from the git hooks/post-receive script.
sergiodj-guest pushed a commit to branch master
in repository libjs-sifter.js.
commit 640c600d9476509428db392bf60d0cf9fa269f90
Author: Sergio Durigan Junior <sergiodj at sergiodj.net>
Date: Fri Dec 8 21:35:24 2017 -0500
New upstream version 0.5.3+dfsg
---
.gitignore | 3 ++-
.travis.yml | 5 ++---
Makefile | 2 +-
bin/sifter.js | 34 ++++++++++++----------------------
bower.json | 2 +-
package.json | 32 +++++++++++++-------------------
6 files changed, 31 insertions(+), 47 deletions(-)
diff --git a/.gitignore b/.gitignore
index e0326fc..165fc09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.DS_store
node_modules
-benchmark/report.json
\ No newline at end of file
+benchmark/report.json
+coverage
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 2ccd59f..6fe3094 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,8 @@
sudo: false
language: node_js
node_js:
- - "0.10"
- - "0.12"
- - "iojs"
+ - "4"
+ - "6"
before_script:
- make
script:
diff --git a/Makefile b/Makefile
index 97a61c0..3c418a3 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ test-ci-coverage:
compile:
@cp lib/sifter.js sifter.js
- $(UGLIFYJS) --mangle -b beautify=false,ascii-only=true --output $(OUT_MIN) $(OUT)
+ $(UGLIFYJS) --mangle -b beautify=false,ascii_only=true --output $(OUT_MIN) $(OUT)
@echo "$(BANNER)" | cat - $(OUT_MIN) > temp && mv temp $(OUT_MIN)
@echo "`cat $(OUT_MIN) | gzip -9f | wc -c` bytes (gzipped)"
diff --git a/bin/sifter.js b/bin/sifter.js
index a87c5e0..6874f47 100755
--- a/bin/sifter.js
+++ b/bin/sifter.js
@@ -3,7 +3,7 @@
/**
* Sifter CLI
*
- * Copyright (c) 2013 Brian Reavis
+ * Copyright (c) 2013-2017 Brian Reavis
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
@@ -26,18 +26,7 @@ var csv = require('csv-parse');
var Stream = require('stream');
var humanize = require('humanize');
var Sifter = require('../lib/sifter');
-var highlight = function(obj) { return cardinal.highlight(JSON.stringify(obj), {json: true}); };
-var microtime;
-
-try {
- microtime = require('microtime');
-} catch(error) {
- microtime = {
- now: function now() {
- return +new Date();
- }
- };
-}
+var highlight = function(obj) { return cardinal.highlight(JSON.stringify(obj)); };
var raw, data, result, t_start, t_end;
var argv = optimist
@@ -62,7 +51,7 @@ var step_read = function(callback) {
var buffer = [];
if (argv.file) {
- fs.readFileSync(argv.file, []);
+ raw = fs.readFileSync(argv.file, 'utf8');
callback();
} else {
process.stdin.on('data', function(chunk) {
@@ -91,7 +80,7 @@ var step_parse = function(callback) {
try {
data = JSON.parse(raw);
} catch (e) {
- return callback('Unable to parse JSON.');
+ return callback(new Error('Unable to parse JSON.'));
}
return callback();
}
@@ -99,6 +88,7 @@ var step_parse = function(callback) {
// csv
data = [];
csv(raw, {columns: true}, function(err, parsed) {
+ if (err) return callback(err);
parsed.forEach(function(line) {
if (Array.isArray(line)) return;
data.push(line);
@@ -119,14 +109,14 @@ var step_sift = function(callback) {
direction: argv.direction
}];
- t_start = microtime.now();
+ t_start = Date.now();
result = sifter.search(argv.query, {
- fields : argv.fields.split(','),
- limit : argv.limit,
- sort : sort
+ fields: (typeof argv.fields !== 'undefined' ? String(argv.fields) : '').split(','),
+ limit: argv.limit,
+ sort: sort
});
- t_end = microtime.now();
+ t_end = Date.now();
callback();
};
@@ -161,6 +151,6 @@ async.series([
step_sift,
step_output
], function(err) {
- if (err) console.error(err);
- process.exit(err ? 1 : 0);
+ if (err) throw err;
+ process.exit(0);
});
diff --git a/bower.json b/bower.json
index 1c4e9ce..88e1075 100644
--- a/bower.json
+++ b/bower.json
@@ -2,7 +2,7 @@
"name": "sifter",
"keywords": ["search","filter","sift","data","results","match","sort","autocomplete"],
"description": "A library for textually searching arrays and hashes of objects by property (or multiple properties). Designed specifically for autocomplete.",
- "version": "0.5.2",
+ "version": "0.5.3",
"license": "Apache License, Version 2.0",
"readmeFilename": "README.md",
"repository": {
diff --git a/package.json b/package.json
index f33347b..8f00017 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"autocomplete"
],
"description": "A library for textually searching arrays and hashes of objects by property (or multiple properties). Designed specifically for autocomplete.",
- "version": "0.5.2",
+ "version": "0.5.3",
"license": "Apache-2.0",
"author": "Brian Reavis <brian at thirdroute.com>",
"main": "./sifter.js",
@@ -20,30 +20,24 @@
"url": "git://github.com/brianreavis/sifter.js.git"
},
"scripts": {
- "test": "mocha -R list"
+ "test": "mocha -R list"
},
"bin": {
"sifter": "./bin/sifter.js"
},
"dependencies": {
- "optimist": "0.6.x",
- "cardinal": "0.4.x",
- "async": "0.2.x",
- "humanize": "0.0.x",
- "csv-parse": "^1.1.7"
+ "optimist": "^0.6.1",
+ "cardinal": "^1.0.0",
+ "async": "^2.6.0",
+ "humanize": "^0.0.9",
+ "csv-parse": "^2.0.0"
},
"devDependencies": {
- "mocha": "1.12.x",
- "mocha-istanbul": "0.2.x",
- "mocha-lcov-reporter": "0.0.x",
- "coveralls": "2.3.x",
- "uglify-js": "2.4.x",
- "istanbul": "0.1.x"
- },
- "optionalDependencies": {
- "microtime": "^2.1.0"
- },
- "engines": {
- "node": "*"
+ "coveralls": "^3.0.0",
+ "istanbul": "^0.4.5",
+ "mocha": "^4.0.1",
+ "mocha-istanbul": "^0.3.0",
+ "mocha-lcov-reporter": "^1.3.0",
+ "uglify-js": "^3.2.0"
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/libjs-sifter.js.git
More information about the Pkg-javascript-commits
mailing list