Skip to content

Commit

Permalink
Changing what's imported from utility
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jan 29, 2019
1 parent 1fb4678 commit 8fcd718
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const path = require("path"),
middleware = require(path.join(__dirname, "middleware.js")),
regex = require(path.join(__dirname, "regex.js")),
{canGet, canModify} = require(path.join(__dirname, "shared.js")),
utility = require(path.join(__dirname, "utility.js")),
{each, explode, hypermedia, serialize} = require(path.join(__dirname, "utility.js")),
renderers = require(path.join(__dirname, "renderers.js")),
serializers = require(path.join(__dirname, "serializers.js")),
Base = require(path.join(__dirname, "base.js"));
Expand Down Expand Up @@ -303,7 +303,7 @@ class Tenso extends Base {

const rheaders = res.getHeaders();

utility.each(Object.keys(headers), i => {
each(Object.keys(headers), i => {
if (rheaders[i] !== void 0) {
if (headers[i] !== rheaders[i]) {
res.removeHeader(i);
Expand Down Expand Up @@ -383,11 +383,11 @@ class Tenso extends Base {
}

let format = "",
accepts = utility.explode(headers["content-type"] || req.parsed.searchParams.get("format") || req.headers.accept || format, ","),
accepts = explode(headers["content-type"] || req.parsed.searchParams.get("format") || req.headers.accept || format, ","),
decorated = res.getHeaders(),
renderer;

utility.each(accepts, i => {
each(accepts, i => {
if (format.length === 0) {
const mimetype = i.replace(regex.mimetype, "");

Expand All @@ -404,7 +404,7 @@ class Tenso extends Base {
renderer = renderers.get(format);
headers["content-type"] = format;

utility.each(Object.keys(decorated), i => {
each(Object.keys(decorated), i => {
if (headers[i] === void 0) {
headers[i] = decorated[i];
}
Expand All @@ -427,7 +427,7 @@ class Tenso extends Base {

if (status !== 204 && status !== 304) {
if (body === null || typeof body.on !== "function") {
result = this.render(req, res, utility.hypermedia(this, req, utility.serialize(req, body, status, headers), headers), headers);
result = this.render(req, res, hypermedia(this, req, serialize(req, body, status, headers), headers), headers);
headers["content-length"] = Buffer.byteLength(result);

if (req.method === "HEAD") {
Expand Down

0 comments on commit 8fcd718

Please sign in to comment.