From bce092aeb84080bc4b3c8cb2e72bda4b9f712596 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 17 Nov 2010 18:25:14 -0800 Subject: [PATCH] Remove leading comma examples --- TODO | 2 -- doc/api/child_processes.markdown | 20 +++++++++---------- doc/api/fs.markdown | 43 +++++++++++++++++++--------------------- doc/api/http.markdown | 30 ++++++++++++---------------- doc/api/process.markdown | 9 ++++----- doc/api/querystring.markdown | 4 +--- 6 files changed, 47 insertions(+), 61 deletions(-) diff --git a/TODO b/TODO index 8a97087..986b1ea 100644 --- a/TODO +++ b/TODO @@ -25,8 +25,6 @@ EventEmitter.optHandlers.encoding() if it exists. - DOCS - - Fix examples using leading comma style. EG - http://nodejs.org/docs/v0.3.1/api/fs.html#fs.stat - anchor links next to each function, for easy linking. EG # diff --git a/doc/api/child_processes.markdown b/doc/api/child_processes.markdown index d186a94..2b67993 100644 --- a/doc/api/child_processes.markdown +++ b/doc/api/child_processes.markdown @@ -57,10 +57,9 @@ If omitted, `args` defaults to an empty Array. The third argument is used to specify additional options, which defaults to: - { cwd: undefined - , env: process.env, - , customFds: [-1, -1, -1] - } + { cwd: undefined, + env: process.env, + customFds: [-1, -1, -1] } `cwd` allows you to specify the working directory from which the process is spawned. Use `env` to specify environment variables that will be visible to the new process. @@ -162,13 +161,12 @@ signal that terminated the process. There is a second optional argument to specify several options. The default options are - { encoding: 'utf8' - , timeout: 0 - , maxBuffer: 200*1024 - , killSignal: 'SIGTERM' - , cwd: null - , env: null - } + { encoding: 'utf8', + timeout: 0, + maxBuffer: 200*1024, + killSignal: 'SIGTERM', + cwd: null, + env: null } If `timeout` is greater than 0, then it will kill the child process if it runs longer than `timeout` milliseconds. The child process is killed with diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown index bebafdf..4433801 100644 --- a/doc/api/fs.markdown +++ b/doc/api/fs.markdown @@ -84,20 +84,19 @@ Synchronous chmod(2). Asynchronous stat(2). The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. It looks like this: - { dev: 2049 - , ino: 305352 - , mode: 16877 - , nlink: 12 - , uid: 1000 - , gid: 1000 - , rdev: 0 - , size: 4096 - , blksize: 4096 - , blocks: 8 - , atime: '2009-06-29T11:11:55Z' - , mtime: '2009-06-29T11:11:40Z' - , ctime: '2009-06-29T11:11:40Z' - } + { dev: 2049, + ino: 305352, + mode: 16877, + nlink: 12, + uid: 1000, + gid: 1000, + rdev: 0, + size: 4096, + blksize: 4096, + blocks: 8, + atime: '2009-06-29T11:11:55Z', + mtime: '2009-06-29T11:11:40Z', + ctime: '2009-06-29T11:11:40Z' } See the `fs.Stats` section below for more information. @@ -350,11 +349,10 @@ Returns a new ReadStream object (See `Readable Stream`). `options` is an object with the following defaults: - { 'flags': 'r' - , 'encoding': null - , 'mode': 0666 - , 'bufferSize': 4 * 1024 - } + { flags: 'r', + encoding: null, + mode: 0666, + bufferSize: 4096 } `options` can include `start` and `end` values to read a range of bytes from the file instead of the entire file. Both `start` and `end` are inclusive and @@ -381,7 +379,6 @@ Returns a new WriteStream object (See `Writable Stream`). `options` is an object with the following defaults: - { 'flags': 'w' - , 'encoding': null - , 'mode': 0666 - } + { flags: 'w', + encoding: null, + mode: 0666 } diff --git a/doc/api/http.markdown b/doc/api/http.markdown index f317d6e..99ffdf1 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -10,11 +10,10 @@ user is able to stream data. HTTP message headers are represented by an object like this: - { 'content-length': '123' - , 'content-type': 'text/plain' - , 'connection': 'keep-alive' - , 'accept': '*/*' - } + { 'content-length': '123', + 'content-type': 'text/plain', + 'connection': 'keep-alive', + 'accept': '*/*' } Keys are lowercased. Values are not modified. @@ -182,22 +181,20 @@ If you would like to parse the URL into its parts, you can use `require('url').parse(request.url)`. Example: node> require('url').parse('/status?name=ryan') - { href: '/status?name=ryan' - , search: '?name=ryan' - , query: 'name=ryan' - , pathname: '/status' - } + { href: '/status?name=ryan', + search: '?name=ryan', + query: 'name=ryan', + pathname: '/status' } If you would like to extract the params from the query string, you can use the `require('querystring').parse` function, or pass `true` as the second argument to `require('url').parse`. Example: node> require('url').parse('/status?name=ryan', true) - { href: '/status?name=ryan' - , search: '?name=ryan' - , query: { name: 'ryan' } - , pathname: '/status' - } + { href: '/status?name=ryan', + search: '?name=ryan', + query: { name: 'ryan' }, + pathname: '/status' } @@ -266,8 +263,7 @@ Example: var body = 'hello world'; response.writeHead(200, { 'Content-Length': body.length, - 'Content-Type': 'text/plain' - }); + 'Content-Type': 'text/plain' }); This method must only be called once on a message and it must be called before `response.end()` is called. diff --git a/doc/api/process.markdown b/doc/api/process.markdown index 8e538d5..3dda98e 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -276,11 +276,10 @@ Returns an object describing the memory usage of the Node process. This will generate: - { rss: 4935680 - , vsize: 41893888 - , heapTotal: 1826816 - , heapUsed: 650472 - } + { rss: 4935680, + vsize: 41893888, + heapTotal: 1826816, + heapUsed: 650472 } `heapTotal` and `heapUsed` refer to V8's memory usage. diff --git a/doc/api/querystring.markdown b/doc/api/querystring.markdown index a9cc4dd..66819cd 100644 --- a/doc/api/querystring.markdown +++ b/doc/api/querystring.markdown @@ -24,9 +24,7 @@ Example: querystring.parse('a=b&b=c') // returns - { 'a': 'b' - , 'b': 'c' - } + { a: 'b', b: 'c' } ### querystring.escape -- 2.7.4