Skip to content

Commit

Permalink
Merge pull request #84 from geek/master
Browse files Browse the repository at this point in the history
Remove dependency and add grunt-cli
  • Loading branch information
linkRace committed Nov 21, 2016
2 parents f12b1ee + 5efd17e commit d38d343
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
9 changes: 3 additions & 6 deletions lib/csp.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
'use strict';

var thing = require('core-util-is');


/**
* Content Security Policy (CSP)
* https://www.owasp.org/index.php/Content_Security_Policy
Expand Down Expand Up @@ -38,15 +35,15 @@ module.exports = function (options) {
var createPolicyString = module.exports.createPolicyString = function (policy) {
var entries;

if (thing.isString(policy)) {
if (typeof policy === 'string') {
return policy;
}

if (thing.isArray(policy)) {
if (Array.isArray(policy)) {
return policy.map(createPolicyString).join('; ');
}

if (thing.isObject(policy)) {
if (typeof policy === 'object' && policy !== null) {
entries = Object.keys(policy).map(function (directive) {
if (policy[directive] === 0 || policy[directive]) {
directive += ' ' + policy[directive];
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@
"errorhandler": "^1.1.1",
"express": "^4.3.8",
"express-session": "^1.7.5",
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.7.0",
"grunt-mocha-test": "~0.7.0",
"grunt": "^0.4.5",
"grunt-cli": "^1.2.0",
"grunt-contrib-jshint": "^0.7.0",
"grunt-mocha-test": "^0.7.0",
"jshint": "*",
"supertest": "^0.13.0"
},
"dependencies": {
"core-util-is": "^1.0.2"
}
"dependencies": {}
}

0 comments on commit d38d343

Please sign in to comment.