Method used by plugin writeFile calls, defined up here to avoid jslint warning about "making a function in a loop".
770829
function makeWriteFile(anonDefRegExp, namespaceWithDot, layer) {
        function writeFile(name, contents) {
            logger.trace('Saving plugin-optimized file: ' + name);
            file.saveUtf8File(name, contents);
        }

        writeFile.asModule = function (moduleName, fileName, contents) {
            writeFile(fileName,
                build.toTransport(anonDefRegExp, namespaceWithDot, moduleName, fileName, contents, layer));
        };

        return writeFile;
    }
774536
function Plugin() {
  // return value should be a callable function
  // with strictly defined options passed by markdown-it
  var self = function(md, options) {
    self.options = options
    self.init(md)
  }

  // initialize plugin object
  self.__proto__ = Plugin.prototype

  self.id     = 'render-readme-meta'

  return self
}
226436
function handlePluginsObject (moduleList) {
    // if moduleList is not defined or empty, we've nothing to do
    if (!moduleList || !moduleList.length) {
        return;
    }

    // Loop through all the modules and then through their clobbers and merges.
    for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
        if (module.clobbers && module.clobbers.length) {
            for (var j = 0; j < module.clobbers.length; j++) {
                modulemapper.clobbers(module.id, module.clobbers[j]);
            }
        }

        if (module.merges && module.merges.length) {
            for (var k = 0; k < module.merges.length; k++) {
                modulemapper.merges(module.id, module.merges[k]);
            }
        }

        // Finally, if runs is truthy we want to simply require() the module.
        if (module.runs) {
            modulemapper.runs(module.id);
        }
    }
}
245581
function(obj, method, args) {
      if (obj) {
        log.events && console.group('[%s] dispatch [%s]', obj.localName, method);
        var fn = typeof method === 'function' ? method : obj[method];
        if (fn) {
          fn[args ? 'apply' : 'call'](obj, args);
        }
        log.events && console.groupEnd();
        // NOTE: dirty check right after calling method to ensure 
        // changes apply quickly; in a very complicated app using high 
        // frequency events, this can be a perf concern; in this case,
        // imperative handlers can be used to avoid flushing.
        Polymer.flush();
      }
    }
549424
function(self, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = {};
  }

  options = options || self.writeConcern;

  if (self.fileId != null) {
    self.chunkCollection().remove({ files_id: self.fileId }, options, function(err) {
      if (err) return callback(err, false);
      callback(null, true);
    });
  } else {
    callback(null, true);
  }
}
540367
function requireJslint(jslintFileName) {
    /*jslint stupid: true */// JSLint doesn't like "*Sync" functions, but in this require-like function async would be overkill
    var jslintCode = bufferToScript(
        fs.readFileSync(
            path.join(__dirname, jslintFileName)
        )
    );
    /*jslint stupid: false */

    var sandbox = {};
    vm.runInNewContext(jslintCode, sandbox, jslintFileName);
    return sandbox.JSLINT;
}
666198
function use(plugin, options){
  utils.assertString(plugin, 'plugin');

  if (options) {
    utils.assertType(options, 'object', 'options');
    options = parseObject(options);
  }

  // lookup
  plugin = plugin.string;
  var found = utils.lookup(plugin, this.options.paths, this.options.filename);
  if (!found) throw new Error('failed to locate plugin file "' + plugin + '"');

  // use
  var fn = require(path.resolve(found));
  if ('function' != typeof fn) {
    throw new Error('plugin "' + plugin + '" does not export a function');
  }
  this.renderer.use(fn(options || this.options));
}
161216
function lintDirectory () {
  var shouldFix = args.hasOwnProperty('fix');

  cli = new eslint.CLIEngine({ configFile: configFilePath, fix: shouldFix });

  report = cli.executeOnFiles(dir);

  if (shouldFix) {
    eslint.CLIEngine.outputFixes(report);
  }

  console.log(cli.getFormatter()(report.results)); // eslint-disable-line

  // End with exit code 1 if there are errors
  // Use process.exit instead of throwing to mimic the behaviour of eslints bin
  // We don't want a stacktrace, it would just be confusing
  if (report.errorCount) {
      process.exit(1); // eslint-disable-line
  }
}
698456
function writeDataToFile (file, data, token) {
  // insertionPoint was set in hasInsertionPoint(), so we can assume it is safe to write to file
  var selectors = [
    'head > meta:last-of-type',
    'head > link:first-of-type',
    'head'
  ]
  var selectorIndex = 0

  switch (insertionPoint) {
    case 'meta':
      selectorIndex = 0
      break
    case 'link':
      selectorIndex = 1
      break
    case 'head':
      selectorIndex = 2
      break
    case 'token':
      let html = String(file.contents).replace(token, data)
      return new Buffer(html)
    default:
      return ''
  }

  var soup = new Soup(String(file.contents))

  // Inject Resource Hints
  soup.setInnerHTML(selectors[selectorIndex], function (oldHTML) {
    if (insertionPoint === 'link') {
      return data + oldHTML
    }
    return oldHTML + data
  })

  return soup.toString()
}
515172
function writeFile (file, callback) {
  fs.outputFile(path.resolve(this._destination, path.join(file.path.dir, file.path.name + file.path.ext)), file.content, function (err) {
    if (err) callback(err);
    callback(null);
  });
}
955628
function (fileName, fileContents, config, onLifecycleName, pluginCollector) {
            /*jslint evil: true */
            var foundIndex = -1, startIndex = 0, lineEndIndex, conditionLine,
                matches, type, marker, condition, isTrue, endRegExp, endMatches,
                endMarkerIndex, shouldInclude, startLength, lifecycleHas, deps,
                i, dep, moduleName, collectorMod,
                lifecyclePragmas, pragmas = config.pragmas, hasConfig = config.has,
                //Legacy arg defined to help in dojo conversion script. Remove later
                //when dojo no longer needs conversion:
                kwArgs = pragmas;

            //Mix in a specific lifecycle scoped object, to allow targeting
            //some pragmas/has tests to only when files are saved, or at different
            //lifecycle events. Do not bother with kwArgs in this section, since
            //the old dojo kwArgs were for all points in the build lifecycle.
            if (onLifecycleName) {
                lifecyclePragmas = config['pragmas' + onLifecycleName];
                lifecycleHas = config['has' + onLifecycleName];

                if (lifecyclePragmas) {
                    pragmas = create(pragmas || {}, lifecyclePragmas);
                }

                if (lifecycleHas) {
                    hasConfig = create(hasConfig || {}, lifecycleHas);
                }
            }

            //Replace has references if desired
            if (hasConfig) {
                fileContents = fileContents.replace(pragma.hasRegExp, function (match, test) {
                    if (hasConfig.hasOwnProperty(test)) {
                        return !!hasConfig[test];
                    }
                    return match;
                });
            }

            if (!config.skipPragmas) {

                while ((foundIndex = fileContents.indexOf("//>>", startIndex)) !== -1) {
                    //Found a conditional. Get the conditional line.
                    lineEndIndex = fileContents.indexOf("\n", foundIndex);
                    if (lineEndIndex === -1) {
                        lineEndIndex = fileContents.length - 1;
                    }

                    //Increment startIndex past the line so the next conditional search can be done.
                    startIndex = lineEndIndex + 1;

                    //Break apart the conditional.
                    conditionLine = fileContents.substring(foundIndex, lineEndIndex + 1);
                    matches = conditionLine.match(pragma.conditionalRegExp);
                    if (matches) {
                        type = matches[1];
                        marker = matches[2];
                        condition = matches[3];
                        isTrue = false;
                        //See if the condition is true.
                        try {
                            isTrue = !!eval("(" + condition + ")");
                        } catch (e) {
                            throw "Error in file: " +
                                   fileName +
                                   ". Conditional comment: " +
                                   conditionLine +
                                   " failed with this error: " + e;
                        }

                        //Find the endpoint marker.
                        endRegExp = new RegExp('\\/\\/\\>\\>\\s*' + type + 'End\\(\\s*[\'"]' + marker + '[\'"]\\s*\\)', "g");
                        endMatches = endRegExp.exec(fileContents.substring(startIndex, fileContents.length));
                        if (endMatches) {
                            endMarkerIndex = startIndex + endRegExp.lastIndex - endMatches[0].length;

                            //Find the next line return based on the match position.
                            lineEndIndex = fileContents.indexOf("\n", endMarkerIndex);
                            if (lineEndIndex === -1) {
                                lineEndIndex = fileContents.length - 1;
                            }

                            //Should we include the segment?
                            shouldInclude = ((type === "exclude" && !isTrue) || (type === "include" && isTrue));

                            //Remove the conditional comments, and optionally remove the content inside
                            //the conditional comments.
                            startLength = startIndex - foundIndex;
                            fileContents = fileContents.substring(0, foundIndex) +
                                (shouldInclude ? fileContents.substring(startIndex, endMarkerIndex) : "") +
                                fileContents.substring(lineEndIndex + 1, fileContents.length);

                            //Move startIndex to foundIndex, since that is the new position in the file
                            //where we need to look for more conditionals in the next while loop pass.
                            startIndex = foundIndex;
                        } else {
                            throw "Error in file: " +
                                  fileName +
                                  ". Cannot find end marker for conditional comment: " +
                                  conditionLine;

                        }
                    }
                }
            }

            //If need to find all plugin resources to optimize, do that now,
            //before namespacing, since the namespacing will change the API
            //names.
            //If there is a plugin collector, scan the file for plugin resources.
            if (config.optimizeAllPluginResources && pluginCollector) {
                try {
                    deps = parse.findDependencies(fileName, fileContents);
                    if (deps.length) {
                        for (i = 0; i < deps.length; i++) {
                            dep = deps[i];
                            if (dep.indexOf('!') !== -1) {
                                moduleName = dep.split('!')[0];
                                collectorMod = pluginCollector[moduleName];
                                if (!collectorMod) {
                                 collectorMod = pluginCollector[moduleName] = [];
                                }
                                collectorMod.push(dep);
                            }
                        }
                    }
                } catch (eDep) {
                    logger.error('Parse error looking for plugin resources in ' +
                                 fileName + ', skipping.');
                }
            }

            //Strip amdefine use for node-shared modules.
            fileContents = fileContents.replace(pragma.amdefineRegExp, '');

            //Do namespacing
            if (onLifecycleName === 'OnSave' && config.namespace) {
                fileContents = pragma.namespace(fileContents, config.namespace, onLifecycleName);
            }


            return pragma.removeStrict(fileContents, config);
        }
899570
protected void writeFunctionJsonFiles(final ObjectWriter objectWriter,
                                          final Map<String, FunctionConfiguration> configMap) throws IOException {
        info("");
        info(SAVE_FUNCTION_JSONS);
        if (configMap.size() == 0) {
            info(SAVE_SKIP);
        } else {
            for (final Map.Entry<String, FunctionConfiguration> config : configMap.entrySet()) {
                writeFunctionJsonFile(objectWriter, config.getKey(), config.getValue());
            }
        }
    }
1254143
function pluginify(name, classname, iterate = true, shorthand = false, ignoreWarning = false) {

  if ( typeof name == 'undefined' || typeof classname == 'undefined' ) {
    console.warn('Pluginify requires a name and class reference');
    return false;
  }

  if (!window.jQuery && !ignoreWarning) {

    console.error(`Pluginify tried to turn "${name}" into a jQuery plugin, but jQuery was not found.`)

  } else {

    let dataName = `__${name}`;
    let old = $.fn[name];
    let warned = false;

    $.fn[name] = function (...option) {

      if (iterate) {

        return this.each((index, element) => {

          let $this = $(element);
          let data = $this.data(dataName);
          let options = $.extend({}, classname.defaults, $this.data(), typeof option === 'object' && option);

          if (!data) {
            $this.data(dataName, (data = new classname(this, options)));
          } else {
            if (!warned) {
              console.warn($this[0],  " These items have already been set to iterate already");
            }
            warned = true;
          }

          if (typeof option === 'string') {
            data[option]();
          }

        });

      } else {

        let $this = $(this);
        let data = $this.data(dataName);
        let options = $.extend({}, classname.defaults, $this.data(), typeof option === 'object' && option);

        if (!data) {
          $this.data(dataName, (data = new classname(this, options)));
        } else {
          if (!warned) {
            console.warn($this[0],  " These items have already been set to iterate already");
          }
          warned = true;
        }

        if (typeof option === 'string') {
          data[option]();
        }

        return data;

      }

    };

    // Generate a shorthand as $.pluginName
    if (shorthand) {
      $[name] = (options) => $({})[name](options);
    }

    // - No conflict
    $.fn[name].noConflict = () => $.fn[name] = old;

  }
}
248945
function (src, callback, context) {
    /*eslint max-statements: [2, 32]*/
    var setup;

    if (callback && typeof callback !== "function") {
      context = callback.context || context;
      setup = callback.setup;
      callback = callback.callback;
    }

    var script = document.createElement("script");
    var done = false;
    var err;
    var _cleanup; // _must_ be set below.

    /**
     * Final handler for error or completion.
     *
     * **Note**: Will only be called _once_.
     *
     * @returns {void}
     */
    var _finish = function () {
      // Only call once.
      if (done) { return; }
      done = true;

      // Internal cleanup.
      _cleanup();

      // Callback.
      if (callback) {
        callback.call(context, err);
      }
    };

    /**
     * Error handler
     *
     * @returns {void}
     */
    var _error = function () {
      err = new Error(src || "EMPTY");
      _finish();
    };

    if (script.readyState && !("async" in script)) {
      /*eslint-disable consistent-return*/

      // This section is only for IE<10. Some other old browsers may
      // satisfy the above condition and enter this branch, but we don't
      // support those browsers anyway.

      var id = scriptCounter++;
      var isReady = { loaded: true, complete: true };
      var inserted = false;

      // Clear out listeners, state.
      _cleanup = function () {
        script.onreadystatechange = script.onerror = null;
        pendingScripts[id] = void 0;
      };

      // Attach the handler before setting src, otherwise we might
      // miss events (consider that IE could fire them synchronously
      // upon setting src, for example).
      script.onreadystatechange = function () {
        var firstState = script.readyState;

        // Protect against any errors from state change randomness.
        if (err) { return; }

        if (!inserted && isReady[firstState]) {
          inserted = true;

          // Append to DOM.
          _addScript(script);
        }

        // --------------------------------------------------------------------
        //                       GLORIOUS IE8 HACKAGE!!!
        // --------------------------------------------------------------------
        //
        // Oh IE8, how you disappoint. IE8 won't call `script.onerror`, so
        // we have to resort to drastic measures.
        // See, e.g. http://www.quirksmode.org/dom/events/error.html#t02
        //
        // As with all things development, there's a Stack Overflow comment that
        // asserts the following combinations of state changes in IE8 indicate a
        // script load error. And crazily, it seems to work!
        //
        // http://stackoverflow.com/a/18840568/741892
        //
        // The `script.readyState` transitions we're interested are:
        //
        // * If state starts as `loaded`
        // * Call `script.children`, which _should_ change state to `complete`
        // * If state is now `loading`, then **we have a load error**
        //
        // For the reader's amusement, here is HeadJS's catalog of various
        // `readyState` transitions in normal operation for IE:
        // https://github.com/headjs/headjs/blob/master/src/2.0.0/load.js#L379-L419
        if (firstState === "loaded") {
          // The act of accessing the property should change the script's
          // `readyState`.
          //
          // And, oh yeah, this hack is so hacky-ish we need the following
          // eslint disable...
          /*eslint-disable no-unused-expressions*/
          script.children;
          /*eslint-enable no-unused-expressions*/

          if (script.readyState === "loading") {
            // State transitions indicate we've hit the load error.
            //
            // **Note**: We are not intending to _return_ a value, just have
            // a shorter short-circuit code path here.
            return _error();
          }
        }

        // It's possible for readyState to be "complete" immediately
        // after we insert (and execute) the script in the branch
        // above. So check readyState again here and react without
        // waiting for another onreadystatechange.
        if (script.readyState === "complete") {
          _finish();
        }
      };

      // Onerror handler _may_ work here.
      script.onerror = _error;

      // Since we're not appending the script to the DOM yet, the
      // reference to our script element might get garbage collected
      // when this function ends, without onreadystatechange ever being
      // fired. This has been witnessed to happen. Adding it to
      // `pendingScripts` ensures this can't happen.
      pendingScripts[id] = script;

      // call the setup callback to mutate the script tag
      if (setup) {
        setup.call(context, script);
      }

      // This triggers a request for the script, but its contents won't
      // be executed until we append it to the DOM.
      script.src = src;

      // In some cases, the readyState is already "loaded" immediately
      // after setting src. It's a lie! Don't append to the DOM until
      // the onreadystatechange event says so.

    } else {
      // This section is for modern browsers, including IE10+.

      // Clear out listeners.
      _cleanup = function () {
        script.onload = script.onerror = null;
      };

      script.onerror = _error;
      script.onload = _finish;
      script.async = true;
      script.charset = "utf-8";

      // call the setup callback to mutate the script tag
      if (setup) {
        setup.call(context, script);
      }

      script.src = src;

      // Append to DOM.
      _addScript(script);
    }
  }
1018883
function functionWriter(&$doclet) {

        parent::MDWriter($doclet);

        $this->_id = "definition";

        $rootDoc = & $this->_doclet->rootDoc();

        $packages = & $rootDoc->packages();
        ksort($packages);

        foreach ($packages as $packageName => $package) {
            $this->_depth = $package->depth() + 1;

            ob_start();

            echo "- - -\n\n";

            echo "#Functions#\n\n";

            echo "- - -\n\n";

            $functions = & $package->functions();

            if ($functions) {
                ksort($functions);
                echo "<table id=\"summary_function\" class=\"title\">", "\n";
                echo "<tr><th colspan=\"2\" class=\"title\">Function Summary</th></tr>", "\n";
                foreach ($functions as $function) {
                    $textTag = & $function->tags("@text");
                    echo "<tr>\n";
                    echo "<td>", $this->_methodSignature($function), "</td>\n";
                    echo "<td class=\"description\">";
                    echo "<p class=\"name\"><a href=\"#", $this->_asURL($function),"\">", $function->name(), "</a>", $this->_flatSignature($function), "</p>";
                    if ($textTag) {
                        echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>";
                    }
                    echo "</td>\n";
                    echo "</tr>\n";
                }
                echo "</table>\n\n";

                echo "<h2 id=\"detail_function\">Function Detail</h2>", "\n";
                foreach ($functions as $function) {
                    $textTag = & $function->tags("@text");
                    $this->_sourceLocation($function);
                    echo "<h3 id=\"", $function->name(), "()\">", $function->name(), "</h3>\n";
                    echo $this->_methodSignature($function);
                    echo " {$function->name()} {$this->_flatSignature($function)}\n\n";
                    echo "<div class=\"details\">\n";
                    if ($textTag) {
                        echo $this->_processInlineTags($textTag), "\n";
                    }
                    $this->_processTags($function->tags());
                    echo "</div>\n\n";
                    echo "- - -\n\n";
                }
            }

            $this->_output = ob_get_contents();
            ob_end_clean();

            $this->_write($this->_normalize($package->_name) . "_package-functions.md");
        }
    }
1310472
function(blob) {
    if (blob.jslint && blob.jslint.length) {
      console.log('\nJSLint reports issues in: '.red + blob.name);
      blob.jslint.forEach(function(i){
        if (i) {
          console.log(' Line ' + i.line + ', Col ' + i.character + ': ' + i.reason);
        }
      });
    }
  }
308442
function lintFile (linter, fileName) {
  const fileContents = fs.readFileSync(fileName, {encoding: 'utf8'}).toString()
  const report = linter.validate(fileContents)
  const errors = report.error.count
  const warnings = report.warn.count

  if (errors || warnings) {
    this.printFilePath(fileName)

    report.error.data.forEach(logItem.bind(this))
    report.warn.data.forEach(logItem.bind(this))

    console.log('') // logging empty line
  }

  return report
}