Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
perf: remove argument reassignment
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Feb 16, 2016
1 parent fa651e2 commit 1a20c81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ unreleased
- deps: [email protected]
- deps: statuses@'>= 1.2.1 < 2'
* perf: enable strict mode
* perf: remove argument reassignment

1.8.3 / 2015-06-10
==================
Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ var Tokens = require('csrf');
*/

module.exports = function csurf(options) {
options = options || {};
var opts = options || {}

// get cookie options
var cookie = getCookieOptions(options.cookie)
var cookie = getCookieOptions(opts.cookie)

// get session options
var sessionKey = options.sessionKey || 'session'
var sessionKey = opts.sessionKey || 'session'

// get value getter
var value = options.value || defaultValue
var value = opts.value || defaultValue

// token repo
var tokens = new Tokens(options);
var tokens = new Tokens(opts)

// ignored methods
var ignoreMethods = options.ignoreMethods === undefined
var ignoreMethods = opts.ignoreMethods === undefined
? ['GET', 'HEAD', 'OPTIONS']
: options.ignoreMethods
: opts.ignoreMethods

if (!Array.isArray(ignoreMethods)) {
throw new TypeError('option ignoreMethods must be an array')
Expand Down

0 comments on commit 1a20c81

Please sign in to comment.