24c85a592b2292b51f060966b77d2fd7c139325b
[platform/upstream/nodejs.git] / deps / npm / html / doc / api / npm-load.html
1 <!doctype html>
2 <html>
3   <title>npm-load</title>
4   <meta http-equiv="content-type" value="text/html;utf-8">
5   <link rel="stylesheet" type="text/css" href="../../static/style.css">
6
7   <body>
8     <div id="wrapper">
9 <h1><a href="../api/npm-load.html">npm-load</a></h1> <p>Load config settings</p>
10
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
12
13 <pre><code>npm.load(conf, cb)</code></pre>
14
15 <h2 id="DESCRIPTION">DESCRIPTION</h2>
16
17 <p>npm.load() must be called before any other function call.  Both parameters are
18 optional, but the second is recommended.</p>
19
20 <p>The first parameter is an object hash of command-line config params, and the
21 second parameter is a callback that will be called when npm is loaded and
22 ready to serve.</p>
23
24 <p>The first parameter should follow a similar structure as the package.json
25 config object.</p>
26
27 <p>For example, to emulate the --dev flag, pass an object that looks like this:</p>
28
29 <pre><code>{
30   &quot;dev&quot;: true
31 }</code></pre>
32
33 <p>For a list of all the available command-line configs, see <code>npm help config</code></p>
34 </div>
35 <p id="footer">npm-load &mdash; npm@1.3.15</p>
36 <script>
37 ;(function () {
38 var wrapper = document.getElementById("wrapper")
39 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
40   .filter(function (el) {
41     return el.parentNode === wrapper
42         && el.tagName.match(/H[1-6]/)
43         && el.id
44   })
45 var l = 2
46   , toc = document.createElement("ul")
47 toc.innerHTML = els.map(function (el) {
48   var i = el.tagName.charAt(1)
49     , out = ""
50   while (i > l) {
51     out += "<ul>"
52     l ++
53   }
54   while (i < l) {
55     out += "</ul>"
56     l --
57   }
58   out += "<li><a href='#" + el.id + "'>" +
59     ( el.innerText || el.text || el.innerHTML)
60     + "</a>"
61   return out
62 }).join("\n")
63 toc.id = "toc"
64 document.body.appendChild(toc)
65 })()
66 </script>