Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(REBASE) Remove collections dependency and es6-set instead #168

Merged
merged 3 commits into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions coverage-report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

require("collections/shim");
var Q = require("q");
var FS = require("./fs");

Expand All @@ -22,7 +20,8 @@ FS.listTree(".coverage_data", function (name, stat) {
console.log(" </tr>");
console.log(" </thead>");
console.log(" <tbody>");
Object.forEach(coverage.files, function (file, path) {
Object.keys(coverage.files).forEach(function (path) {
var file = coverage.files[path];
path = FS.relativeFromDirectory(__dirname, path);
if (/^spec/.test(path))
return;
Expand Down
2 changes: 1 addition & 1 deletion fs-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var Boot = require("./fs-boot");
var Common = require("./fs-common");
var BufferStream = require("./buffer-stream");
var Reader = require("./reader");
var Set = require("collections/set");
var Set = require("es6-set");

module.exports = MockFs;

Expand Down
1 change: 0 additions & 1 deletion http-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
* @module
*/

require("collections/shim");
var Q = require("q");
var HTTP = require("./http");
var FS = require("./fs");
Expand Down
7 changes: 3 additions & 4 deletions http-apps/negotiate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ function negotiate(request, types, header) {
* @returns {App}
*/
exports.Method = function (methods, methodNotAllowed) {
var keys = Object.keys(methods);
if (!methodNotAllowed)
methodNotAllowed = Status.methodNotAllowed;
return function (request) {
var method = request.method;
if (Object.has(keys, method)) {
return Object.get(methods, method)(request);
if (Object.prototype.hasOwnProperty.call(methods, method) !== -1) {
return methods[method](request);
} else {
return methodNotAllowed(request);
}
Expand All @@ -41,7 +40,7 @@ var Negotiator = function (requestHeader, responseHeader, respond) {
var type = MimeParse.bestMatch(keys, accept);
request.terms = request.terms || {};
request.terms[responseHeader] = type;
if (Object.has(keys, type)) {
if (keys.indexOf(type) !== -1) {
return Q.when(types[type](request), function (response) {
if (
respond !== null &&
Expand Down
4 changes: 2 additions & 2 deletions http-apps/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ exports.Branch = function (paths, notFound) {
var path = request.pathInfo.slice(1);
var parts = path.split("/");
var part = decodeURIComponent(parts.shift());
if (Object.has(paths, part)) {
if (hasOwnProperty.call(paths, part)) {
request.scriptName = request.scriptName + part + "/";
request.pathInfo = path.slice(part.length);
return Object.get(paths, part)(request, response);
return paths[part](request, response);
}
return notFound(request, response);
};
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"url": "http://github.com/kriskowal/q-io.git"
},
"dependencies": {
"collections": "^5.1.3",
"es6-set": "^0.1.1",
"mime": "^1.2.11",
"mimeparse": "^0.1.4",
"q": "^1.0.1",
"qs": "^6.4.0",
"qs": "^1.2.1",
"url2": "^0.0.0"
},
"devDependencies": {
Expand Down