MCPcopy Create free account
hub / github.com/browserify/static-module / getOptions

Function getOptions

bench/input.js:399–419  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

397// Interpret and default an options object
398
399function getOptions(opts) {
400 var options = {};
401
402 for (var opt in defaultOptions)
403 { options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; }
404
405 if (options.ecmaVersion >= 2015)
406 { options.ecmaVersion -= 2009; }
407
408 if (options.allowReserved == null)
409 { options.allowReserved = options.ecmaVersion < 5; }
410
411 if (isArray(options.onToken)) {
412 var tokens = options.onToken;
413 options.onToken = function (token) { return tokens.push(token); };
414 }
415 if (isArray(options.onComment))
416 { options.onComment = pushComment(options, options.onComment); }
417
418 return options
419}
420
421function pushComment(options, array) {
422 return function(block, text, start, end, startLoc, endLoc) {

Callers 1

ParserFunction · 0.85

Calls 2

hasFunction · 0.85
pushCommentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…