Vse Mozhet Byt
4d67369c1b
doc: fix various nits
...
* Replace 2 hyphens (--) by spaced m-dashes (—) as per STYLE_GUIDE.md.
* Space infix operators.
* Unify quotes in inline code spans (use only single quotes).
* Unify `* Returns:` (eliminate deviations).
* Dedupe spaces.
Backport-PR-URL: https://github.com/nodejs/node/pull/19761
PR-URL: https://github.com/nodejs/node/pull/19743
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-04-13 00:19:34 -04:00
Roman Reiss
7af1ad0ec1
util: add %i and %f formatting specifiers
...
This change brings formatting specifiers available in `util.format` and
consequently, `console.*` closer to what is supported in all major
browsers.
- `%i` is introduced to format integer values.
- `%f` is introduced to format floating point values.
Fixes: https://github.com/nodejs/node/issues/10292
PR-URL: https://github.com/nodejs/node/pull/10308
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-01-15 16:23:08 -05:00
Chris Young
ecea33b277
doc: add links to alternative versions of doc
...
Each page of the API documentation should have links to other versions
of the same page. This will make it easier to switch between the current
"live" release at nodejs.org and LTS versions.
Backport-PR-URL: https://github.com/nodejs/node/pull/15670
PR-URL: https://github.com/nodejs/node/pull/10958
Fixes: https://github.com/nodejs/node/issues/10726
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-29 13:31:45 -04:00
Natanael Log
7f6f1c2ddc
doc, util, console: clarify ambiguous docs
...
Add clarification to the documentation on util.format()
and console.log() regarding how excessive arguments are treated
when the first argument is a non-format string
compared to when it is not a string at all.
PR-URL: https://github.com/nodejs/node/pull/14027
Fixes: https://github.com/nodejs/node/issues/13908
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-08-15 20:57:35 -07:00
Vse Mozhet Byt
8c0849d5db
doc: conform to rules for eslint-plugin-markdown
...
Backport-PR-URL: https://github.com/nodejs/node/pull/14067
PR-URL: https://github.com/nodejs/node/pull/12563
Refs: https://github.com/nodejs/node/pull/12557#issuecomment-296015032
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
2017-07-30 23:11:10 -05:00
Rich Trott
7e6a956a29
test,lib,doc: use function declarations
...
Replace function expressions with function declarations in preparation
for a lint rule requiring function declarations.
PR-URL: https://github.com/nodejs/node/pull/12711
Backport-PR-URL: https://github.com/nodejs/node/pull/13774
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
2017-07-11 17:43:47 +01:00
Roman Reiss
dd1fb98bda
doc: consistent case for primitive types
...
PR-URL: https://github.com/nodejs/node/pull/11167
Backport-PR-URL: https://github.com/nodejs/node/pull/13054
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-07-11 17:42:58 +01:00
Tarun Batra
3ae8d00dd1
doc: add single arg scenario for util.format
...
Set the expected outcome of `util.format('%%')` to be `%%`
instead of `%`.
PR-URL: https://github.com/nodejs/node/pull/12374
Fixes: https://github.com/nodejs/node/issues/12362
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-05-17 21:31:50 -04:00
Vse Mozhet Byt
1150af00f7
doc: improve consistency in documentation titles
...
Unify capitalization and spaces and add some info for consistency,
clarity and coherence with sorting in the all.md / _toc.md.
PR-URL: https://github.com/nodejs/node/pull/11230
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-03-08 17:10:43 -08:00
Adam Brunner
1c9817cbeb
doc: "util" is not needed to extend ES6 classes
...
PR-URL: https://github.com/nodejs/node/pull/9737
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Italo A. Casas <me@italoacasas.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2016-12-20 14:24:24 -05:00
Daniel Bevenius
d283704cd6
doc: make comment indentation consistent
...
Currently, some of the docs use different indentation for comments
in the code examples. This commit makes the indentation consistent
by putting the comments at the beginning of the line (really no
indentation that is).
PR-URL: https://github.com/nodejs/node/pull/9518
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2016-12-13 16:02:52 -05:00
Ryan Scheel (Havvy)
adee93962a
doc: more realistic custom inspect example
...
Changes the custom inspect example to a more complex object that
actually uses the parameters of the custom inspect function. I
specifically chose a wrapper of a value called a "Box" that inspects
to "Box < inner_inspect_value >".
I also want there to be documentation explaining what the code is
actually doing. E.g., the padding replacement part is to make the
inspected value line up properly when multi-line inputs are given.
I also went with having a space between the Box's brackets and the inner
value because it matches how objects work, and that should definitely be
listed as a convention somewhere in here.
Also, the convention to shorten only when depth is less than 0, not e.g.
at 0.
But I don't know how to write the documentation for that, so I'm leaving
that to somebody who reads this message.
Ref: https://github.com/nodejs/node/issues/8442
PR-URL: https://github.com/nodejs/node/pull/8875
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-11-18 19:03:51 -05:00
Сковорода Никита Андреевич
336d505dd9
tools: enable more remark-lint rules
...
New rules:
1. rule-style
2. strong-marker
3. no-shell-dollars
4. no-inline-padding
5. code-block-style
6. no-multiple-toplevel-headings
Fixes to the existing files applied.
PR-URL: https://github.com/nodejs/node/pull/8708
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
Reviewed-By: Johan Bergström <bugs@bergstroem.nu >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-10-11 12:28:39 -04:00
Timothy Gu
929d9bb222
doc: standardize rest parameters
...
PR-URL: https://github.com/nodejs/node/pull/8485
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-10-11 12:26:30 -04:00
Jeremiah Senkpiel
0a3ad92292
2016-09-14, Version 6.6.0 (Current)
...
Notable changes:
* crypto: Added `crypto.timingSafeEqual()`. (not-an-aardvark)
https://github.com/nodejs/node/pull/8304
* events: Made the "max event listeners" memory leak warning more
accessible. (Anna Henningsen) https://github.com/nodejs/node/pull/8298
* promises: Unhandled rejections now emit a process warning after the
first tick. (Benjamin Gruenbaum)
https://github.com/nodejs/node/pull/8223
* repl: Added auto alignment for `.editor` mode. (Prince J Wesley)
https://github.com/nodejs/node/pull/8241
* util: Some functionality has been added to `util.inspect()`:
- Returning `this` from a custom inspect function now works. (Anna
Henningsen) https://github.com/nodejs/node/pull/8174
- Added support for Symbol-based custom inspection methods. (Anna
Henningsen) https://github.com/nodejs/node/pull/8174
Refs: https://github.com/nodejs/node/issues/8428
Refs: https://github.com/nodejs/node/pull/8457
PR-URL: https://github.com/nodejs/node/pull/8466
2016-09-14 10:13:08 -07:00
Sakthipriyan Vairamani
d67ece2f68
util: improve function signature of util._extend
...
The function signature of `util._extend` is not intuitive and the
documentation doesn't specify the necessary second parameter. This
patch changes the parameter names in the code and the function params
in doc.
PR-URL: https://github.com/nodejs/node/pull/8187
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-09-09 11:06:06 -04:00
Anna Henningsen
4cb55ff392
util: allow symbol-based custom inspection methods
...
Add a `util.inspect.custom` Symbol which can be used to customize
`util.inspect()` output. Providing `obj[util.inspect.custom]`
works like providing `obj.inspect`, except that the former allows
avoiding name clashes with other `inspect()` methods.
Fixes: https://github.com/nodejs/node/issues/8071
PR-URL: https://github.com/nodejs/node/pull/8174
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Refs: https://github.com/nodejs/node/pull/8437
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2016-09-09 11:06:02 -04:00
Luigi Pinca
d9142b4bd6
doc: add added: information for util
...
PR-URL: https://github.com/nodejs/node/pull/8206
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Bryan English <bryan@bryanenglish.com >
2016-08-24 08:36:46 -05:00
Shahid Shaikh
afbe4d8ebd
doc: add es6 code example in util.md
...
Added class/extends example to util.md
PR-URL: https://github.com/nodejs/node/pull/8183
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com >
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com >
2016-08-24 07:58:24 -05:00
Roman Reiss
cfec3ae5fd
util: add inspect.defaultOptions
...
Adds util.inspect.defaultOptions which allows customization of the
default util.inspect options, which is useful for functions like
console.log or util.format which implicitly call into util.inspect.
PR-URL: https://github.com/nodejs/node/pull/8013
Fixes: https://github.com/nodejs/node/issues/7566
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2016-08-10 13:03:16 -04:00
Anna Henningsen
e116cf96a0
doc: use blockquotes for Stability: markers
...
Use blockquotes instead of code blocks for stability markers in
the docs. Doing that:
- Makes the makers appear correctly when viewed e.g. on github.
- Allows remark-lint rules like `no-undefined-references` to work
properly (https://github.com/nodejs/node/pull/7729 ).
PR-URL: https://github.com/nodejs/node/pull/7757
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Conflicts:
doc/api/punycode.md
2016-08-10 12:41:56 -04:00
vladimir
295d1ea016
util: support classes in util.deprecate()
...
Classes cannot be instantiated without new, but util.deprecate()
uses Function.prototype.apply(). This commit uses new.target to
detect constructor calls, allowing classes to be deprecated.
PR-URL: https://github.com/nodejs/node/pull/7690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-10 12:31:02 -04:00
Сковорода Никита Андреевич
0ffeddb5b4
doc: various documentation formatting fixes
...
* Fix markdown code sample in releases.md, it was <a id="x.y.x></a>"
* Fix some markdown errors, e.g. in changelogs
* Fix broken defs links, e.g. in domain-postmortem.md
* Fix other broken refs, by addaleax
* Add links to some defs that were present but not linked to
* Remove dead defs
* Move defs to the bottom (one file affected)
* Add language indicators to all code blocks, using `txt` when no
specific language could be chosen
* Some minor formatting changes (spaces, ident, headings)
PR-URL: https://github.com/nodejs/node/pull/7637
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Roman Reiss <me@silverwind.io >
Conflicts:
doc/api/zlib.md
doc/changelogs/CHANGELOG_V4.md
2016-08-10 11:16:06 -04:00
saadq
1f003590d6
doc: fix inconsistencies in code style
...
Adds missing semicolons, removes extra white space, and properly indents
various code snippets in the documentation.
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/7745
2016-07-20 06:36:29 -05:00
Evan Lucas
f15d2d6dae
doc: fix util.deprecate() example
...
The arguments object is not created for arrow functions so the example
was incorrect.
PR-URL: https://github.com/nodejs/node/pull/7674
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-07-15 08:18:31 -05:00
Sakthipriyan Vairamani
58b70d34ee
doc: link and highlight Object.assign
...
PR-URL: https://github.com/nodejs/node/pull/7670
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-07-15 08:18:25 -05:00
cjihrig
3b8914d5ce
util: add an option for configuring break length
...
This commit adds a breakLength option to util.inspect(). This
option allows users to control the length at which object keys
are split across multiple lines. For backwards compatibility,
this option defaults to 60.
Fixes: https://github.com/nodejs/node/issues/7305
PR-URL: https://github.com/nodejs/node/pull/7499
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2016-07-06 14:20:19 +02:00
James M Snell
dd4c607267
doc: fix header depth of util.isSymbol
...
PR-URL: https://github.com/nodejs/node/pull/7138
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-06-15 18:00:14 -05:00
Jeremiah Senkpiel
1c1256718e
doc: addresses nits in string_decoder, url, util
...
- Only `@@toStringTag` affects `util.isError()`, this is the reason why
it uses `Object.prototype.toString.call(argument)` under the hood.
- Shows an actual Euro symbol for reference.
- Uses line-drawing characters for the URL chart & fixes the chart
borders.
PR-URL: https://github.com/nodejs/node/pull/7026
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-06-02 22:42:02 +10:00
Sakthipriyan Vairamani
3518ab93b1
doc: minor improvements to util.md
...
PR-URL: https://github.com/nodejs/node/pull/6932
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-06-02 22:41:59 +10:00
James M Snell
a320a019f1
doc: general improvements to util.md
...
PR-URL: https://github.com/nodejs/node/pull/6897
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com >
2016-06-02 22:39:17 +10:00
Robert Jefe Lindstaedt
d49b49e8b1
doc: discourage use of util.inherits
...
util.inherits breaks the prototype chain. A fix does not seem
useful, since ES6 extends provides language level support for the
same functionality.
This commit starts fasing out mentions of the method.
Fixes: https://github.com/nodejs/node/issues/6512
Fixes: https://github.com/nodejs/node/issues/4179
PR-URL: https://github.com/nodejs/node/pull/6514
Reviewed-By: James Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-05-17 08:42:41 -05:00
Anna Henningsen
1d6c17efd7
util: adhere to noDeprecation set at runtime
...
Until now, the docs stated that `process.noDeprecation` could be set
at runtime, but before any modules were loaded. That was not true,
because `lib/internal/util.js` was loaded during the process startup
process, so setting the flag at runtime was pointless.
Minimal test case:
process.noDeprecation = true;
process.EventEmitter;
This patch moves checking `process.noDeprecation` to the place where
it was actually used.
PR-URL: https://github.com/nodejs/node/pull/6683
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-05-17 08:08:09 -05:00
James M Snell
91ab769940
util: truncate inspect array and typed array
...
As an alternative to https://github.com/nodejs/node/pull/5070 ,
set the max length of Arrays/TypedArrays in util.inspect() to
`100` and provide a `maxArrayLength` option to override.
PR-URL: https://github.com/nodejs/node/pull/6334
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
2016-05-03 20:20:43 -04:00
James M Snell
0bca959617
util: fix inspecting of proxy objects
...
In certain conditions, inspecting a Proxy object can lead to a
max call stack error. Avoid that by detecting the Proxy object
and outputting information about the Proxy object itself.
Fixes: https://github.com/nodejs/node/issues/6464
PR-URL: https://github.com/nodejs/node/pull/6465
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-05-03 20:20:42 -04:00
cjihrig
3e028a143c
doc: remove obsolete comment in isError() example
...
One of the util.isError() examples states that a harmony flag
is required. As of v6.0.0, this is no longer true. This commit
removes the out of date reference.
Refs: https://github.com/nodejs/node/pull/5414
PR-URL: https://github.com/nodejs/node/pull/6486
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-05-03 20:20:39 -04:00
Jackson Tian
19fb1345ba
doc: use Buffer.from() instead of new Buffer()
...
Use new API of Buffer to developers in most documents.
PR-URL: https://github.com/nodejs/node/pull/6367
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
2016-05-03 20:20:31 -04:00
Jackson Tian
fa74805bac
doc: doc-only deprecation for util.log()
...
There are more powerful loggers in user land like `debug`, soft
deprecate it.
PR-URL: https://github.com/nodejs/node/pull/6161
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2016-04-26 12:16:38 -07:00
Robert Jefe Lindstaedt
edc6970a1f
doc: git mv to .md
...
* doc: rename .markdown references in content
* doc: rename to .md in tools
* doc: rename to .md in CONTRIBUTING.md
PR-URL: https://github.com/nodejs/node/pull/4747
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: techjeffharris
Reviewed-By: Johan Bergström <bugs@bergstroem.nu >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-04-26 12:16:28 -07:00