Skip to content

Commit 0f2a80c

Browse files
committed
Couple JSDoc markup improvements
1 parent 434881a commit 0f2a80c

17 files changed

+69
-70
lines changed

src/v1/driver.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ const DEFAULT_MAX_CONNECTION_LIFETIME = 60 * 60 * 1000; // 1 hour
3333

3434
/**
3535
* Constant that represents read session access mode.
36-
* Should be used like this: <code>driver.session(READ)</code>.
36+
* Should be used like this: `driver.session(neo4j.session.READ)`.
3737
* @type {string}
3838
*/
3939
const READ = 'READ';
4040

4141
/**
4242
* Constant that represents write session access mode.
43-
* Should be used like this: <code>driver.session(WRITE)</code>.
43+
* Should be used like this: `driver.session(neo4j.session.WRITE)`.
4444
* @type {string}
4545
*/
4646
const WRITE = 'WRITE';

src/v1/index.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ const auth = {
6969
const USER_AGENT = "neo4j-javascript/" + VERSION;
7070

7171
/**
72-
* Object containing predefined logging configurations. These are expected to be used as values of the driver config's <code>logging</code> property.
73-
* @property {function(level: ?string): object} console the function to create a logging config that prints all messages to <code>console.log</code> with
74-
* timestamp, level and message. It takes an optional <code>level</code> parameter which represents the maximum log level to be logged. Default value is 'info'.
72+
* Object containing predefined logging configurations. These are expected to be used as values of the driver config's `logging` property.
73+
* @property {function(level: ?string): object} console the function to create a logging config that prints all messages to `console.log` with
74+
* timestamp, level and message. It takes an optional `level` parameter which represents the maximum log level to be logged. Default value is 'info'.
7575
*/
7676
const logging = {
7777
console: level => {
@@ -136,7 +136,7 @@ const logging = {
136136
*
137137
* // The max number of connections that are allowed idle in the pool at any time.
138138
* // Connection will be destroyed if this threshold is exceeded.
139-
* // <b>Deprecated:</b> please use <code>maxConnectionPoolSize</code> instead.
139+
* // **Deprecated:** please use `maxConnectionPoolSize` instead.
140140
* connectionPoolSize: 100,
141141
*
142142
* // The maximum total number of connections allowed to be managed by the connection pool, per host.
@@ -158,15 +158,15 @@ const logging = {
158158
* connectionAcquisitionTimeout: 60000, // 1 minute
159159
*
160160
* // Specify the maximum time in milliseconds transactions are allowed to retry via
161-
* // <code>Session#readTransaction()</code> and <code>Session#writeTransaction()</code> functions.
161+
* // `Session#readTransaction()` and `Session#writeTransaction()` functions.
162162
* // These functions will retry the given unit of work on `ServiceUnavailable`, `SessionExpired` and transient
163163
* // errors with exponential backoff using initial delay of 1 second.
164164
* // Default value is 30000 which is 30 seconds.
165165
* maxTransactionRetryTime: 30000, // 30 seconds
166166
*
167167
* // Provide an alternative load balancing strategy for the routing driver to use.
168168
* // Driver uses "least_connected" by default.
169-
* // <b>Note:</b> We are experimenting with different strategies. This could be removed in the next minor
169+
* // **Note:** We are experimenting with different strategies. This could be removed in the next minor
170170
* // version.
171171
* loadBalancingStrategy: "least_connected" | "round_robin",
172172
*
@@ -177,27 +177,27 @@ const logging = {
177177
*
178178
* // Make this driver always return native JavaScript numbers for integer values, instead of the
179179
* // dedicated {@link Integer} class. Values that do not fit in native number bit range will be represented as
180-
* // <code>Number.NEGATIVE_INFINITY</code> or <code>Number.POSITIVE_INFINITY</code>.
181-
* // <b>Warning:</b> It is not always safe to enable this setting when JavaScript applications are not the only ones
180+
* // `Number.NEGATIVE_INFINITY` or `Number.POSITIVE_INFINITY`.
181+
* // **Warning:** ResultSummary It is not always safe to enable this setting when JavaScript applications are not the only ones
182182
* // interacting with the database. Stored numbers might in such case be not representable by native
183183
* // {@link Number} type and thus driver will return lossy values. This might also happen when data was
184184
* // initially imported using neo4j import tool and contained numbers larger than
185-
* // <code>Number.MAX_SAFE_INTEGER</code>. Driver will then return positive infinity, which is lossy.
186-
* // Default value for this option is <code>false</code> because native JavaScript numbers might result
185+
* // `Number.MAX_SAFE_INTEGER`. Driver will then return positive infinity, which is lossy.
186+
* // Default value for this option is `false` because native JavaScript numbers might result
187187
* // in loss of precision in the general case.
188188
* disableLosslessIntegers: false,
189189
*
190-
* // Specify the logging configuration for the driver. Object should have two properties <code>level</code> and <code>logger</code>.
190+
* // Specify the logging configuration for the driver. Object should have two properties `level` and `logger`.
191191
* //
192-
* // Property <code>level</code> represents the logging level which should be one of: 'error', 'warn', 'info' or 'debug'. This property is optional and
192+
* // Property `level` represents the logging level which should be one of: 'error', 'warn', 'info' or 'debug'. This property is optional and
193193
* // its default value is 'info'. Levels have priorities: 'error': 0, 'warn': 1, 'info': 2, 'debug': 3. Enabling a certain level also enables all
194194
* // levels with lower priority. For example: 'error', 'warn' and 'info' will be logged when 'info' level is configured.
195195
* //
196-
* // Property <code>logger</code> represents the logging function which will be invoked for every log call with an acceptable level. The function should
197-
* // take two string arguments <code>level</code> and <code>message</code>. The function should not execute any blocking or long-running operations
196+
* // Property `logger` represents the logging function which will be invoked for every log call with an acceptable level. The function should
197+
* // take two string arguments `level` and `message`. The function should not execute any blocking or long-running operations
198198
* // because it is often executed on a hot path.
199199
* //
200-
* // No logging is done by default. See <code>neo4j.logging</code> object that contains predefined logging implementations.
200+
* // No logging is done by default. See `neo4j.logging` object that contains predefined logging implementations.
201201
* logging: {
202202
* level: 'info',
203203
* logger: (level, message) => console.log(level + ' ' + message)

src/v1/integer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import {newError} from './error';
2626
/**
2727
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
2828
* See exported functions for more convenient ways of operating integers.
29-
* Use <code>int()</code> function to create new integers, <code>isInt()</code> to check if given object is integer,
30-
* <code>inSafeRange()</code> to check if it is safe to convert given value to native number,
31-
* <code>toNumber()</code> and <code>toString()</code> to convert given integer to number or string respectively.
29+
* Use `int()` function to create new integers, `isInt()` to check if given object is integer,
30+
* `inSafeRange()` to check if it is safe to convert given value to native number,
31+
* `toNumber()` and `toString()` to convert given integer to number or string respectively.
3232
* @access public
3333
* @exports Integer
3434
* @class A Integer class for representing a 64 bit two's-complement integer value.

src/v1/internal/bookmark.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ export default class Bookmark {
4242

4343
/**
4444
* Check if the given bookmark is meaningful and can be send to the database.
45-
* @return {boolean} returns <code>true</code> bookmark has a value, <code>false</code> otherwise.
45+
* @return {boolean} returns `true` bookmark has a value, `false` otherwise.
4646
*/
4747
isEmpty() {
4848
return this._maxValue === null;
4949
}
5050

5151
/**
5252
* Get maximum value of this bookmark as string.
53-
* @return {string|null} the maximum value or <code>null</code> if it is not defined.
53+
* @return {string|null} the maximum value or `null` if it is not defined.
5454
*/
5555
maxBookmarkAsString() {
5656
return this._maxValue;

src/v1/internal/ch-websocket.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -265,23 +265,23 @@ function determineWebSocketScheme(config, protocolSupplier) {
265265

266266
/**
267267
* @param {ChannelConfig} config - configuration for the channel.
268-
* @return {boolean} <code>true</code> if encryption enabled in the config, <code>false</code> otherwise.
268+
* @return {boolean} `true` if encryption enabled in the config, `false` otherwise.
269269
*/
270270
function isEncryptionExplicitlyTurnedOn(config) {
271271
return config.encrypted === true || config.encrypted === ENCRYPTION_ON;
272272
}
273273

274274
/**
275275
* @param {ChannelConfig} config - configuration for the channel.
276-
* @return {boolean} <code>true</code> if encryption disabled in the config, <code>false</code> otherwise.
276+
* @return {boolean} `true` if encryption disabled in the config, `false` otherwise.
277277
*/
278278
function isEncryptionExplicitlyTurnedOff(config) {
279279
return config.encrypted === false || config.encrypted === ENCRYPTION_OFF;
280280
}
281281

282282
/**
283283
* @param {function(): string} protocolSupplier - function that detects protocol of the web page.
284-
* @return {boolean} <code>true</code> if protocol returned by the given function is secure, <code>false</code> otherwise.
284+
* @return {boolean} `true` if protocol returned by the given function is secure, `false` otherwise.
285285
*/
286286
function isProtocolSecure(protocolSupplier) {
287287
const protocol = typeof protocolSupplier === 'function' ? protocolSupplier() : '';

src/v1/internal/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export default class Connection {
196196
* Write a message to the network channel.
197197
* @param {RequestMessage} message the message to write.
198198
* @param {StreamObserver} observer the response observer.
199-
* @param {boolean} flush <code>true</code> if flush should happen after the message is written to the buffer.
199+
* @param {boolean} flush `true` if flush should happen after the message is written to the buffer.
200200
*/
201201
write(message, observer, flush) {
202202
const queued = this._queueObserver(observer);

src/v1/internal/load-balancing-strategy.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class LoadBalancingStrategy {
2525
/**
2626
* Select next most appropriate reader from the list of given readers.
2727
* @param {string[]} knownReaders an array of currently known readers to select from.
28-
* @return {string} most appropriate reader or <code>null</code> if given array is empty.
28+
* @return {string} most appropriate reader or `null` if given array is empty.
2929
*/
3030
selectReader(knownReaders) {
3131
throw new Error('Abstract function');
@@ -34,7 +34,7 @@ export default class LoadBalancingStrategy {
3434
/**
3535
* Select next most appropriate writer from the list of given writers.
3636
* @param {string[]} knownWriters an array of currently known writers to select from.
37-
* @return {string} most appropriate writer or <code>null</code> if given array is empty.
37+
* @return {string} most appropriate writer or `null` if given array is empty.
3838
*/
3939
selectWriter(knownWriters) {
4040
throw new Error('Abstract function');

src/v1/internal/logger.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Logger {
7272

7373
/**
7474
* Check if error logging is enabled, i.e. it is not a no-op implementation.
75-
* @return {boolean} <code>true</code> when enabled, <code>false</code> otherwise.
75+
* @return {boolean} `true` when enabled, `false` otherwise.
7676
*/
7777
isErrorEnabled() {
7878
return isLevelEnabled(this._level, ERROR);
@@ -90,7 +90,7 @@ class Logger {
9090

9191
/**
9292
* Check if warn logging is enabled, i.e. it is not a no-op implementation.
93-
* @return {boolean} <code>true</code> when enabled, <code>false</code> otherwise.
93+
* @return {boolean} `true` when enabled, `false` otherwise.
9494
*/
9595
isWarnEnabled() {
9696
return isLevelEnabled(this._level, WARN);
@@ -108,7 +108,7 @@ class Logger {
108108

109109
/**
110110
* Check if info logging is enabled, i.e. it is not a no-op implementation.
111-
* @return {boolean} <code>true</code> when enabled, <code>false</code> otherwise.
111+
* @return {boolean} `true` when enabled, `false` otherwise.
112112
*/
113113
isInfoEnabled() {
114114
return isLevelEnabled(this._level, INFO);
@@ -126,7 +126,7 @@ class Logger {
126126

127127
/**
128128
* Check if debug logging is enabled, i.e. it is not a no-op implementation.
129-
* @return {boolean} <code>true</code> when enabled, <code>false</code> otherwise.
129+
* @return {boolean} `true` when enabled, `false` otherwise.
130130
*/
131131
isDebugEnabled() {
132132
return isLevelEnabled(this._level, DEBUG);
@@ -184,7 +184,7 @@ const noOpLogger = new NoOpLogger();
184184
* Check if the given logging level is enabled.
185185
* @param {string} configuredLevel the configured level.
186186
* @param {string} targetLevel the level to check.
187-
* @return {boolean} value of <code>true</code> when enabled, <code>false</code> otherwise.
187+
* @return {boolean} value of `true` when enabled, `false` otherwise.
188188
*/
189189
function isLevelEnabled(configuredLevel, targetLevel) {
190190
return levels[configuredLevel] >= levels[targetLevel];

src/v1/internal/pool.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class Pool {
121121
/**
122122
* Check if this pool contains resources for the given key.
123123
* @param {string} key the resource key to check.
124-
* @return {boolean} <code>true</code> when pool contains entries for the given key, <code>false</code> otherwise.
124+
* @return {boolean} `true` when pool contains entries for the given key, <code>false</code> otherwise.
125125
*/
126126
has(key) {
127127
return (key in this._pools);

src/v1/internal/routing-table.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ export default class RoutingTable {
5757
/**
5858
* Check if this routing table is fresh to perform the required operation.
5959
* @param {string} accessMode the type of operation. Allowed values are {@link READ} and {@link WRITE}.
60-
* @return {boolean} <code>true</code> when this table contains servers to serve the required operation,
61-
* <code>false</code> otherwise.
60+
* @return {boolean} `true` when this table contains servers to serve the required operation, `false` otherwise.
6261
*/
6362
isStaleFor(accessMode) {
6463
return this.expirationTime.lessThan(Date.now()) ||

src/v1/internal/temporal-util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {newError} from '../error';
2727
2828
It is based on a library called ThreeTen (https://github.com/ThreeTen/threetenbp) which was derived
2929
from JSR-310 reference implementation previously hosted on GitHub. Code uses `Integer` type everywhere
30-
to correctly handle large integer values that are greater than <code>Number.MAX_SAFE_INTEGER</code>.
30+
to correctly handle large integer values that are greater than `Number.MAX_SAFE_INTEGER`.
3131
3232
Please consult either ThreeTen or js-joda (https://github.com/js-joda/js-joda) when working with the
3333
conversion functions.
@@ -416,7 +416,7 @@ function localTimeToSecondOfDay(hour, minute, second) {
416416
/**
417417
* Check if given year is a leap year. Uses algorithm described here {@link https://en.wikipedia.org/wiki/Leap_year#Algorithm}.
418418
* @param {Integer|number|string} year the year to check. Will be converted to {@link Integer} for all calculations.
419-
* @return {boolean} <code>true</code> if given year is a leap year, <code>false</code> otherwise.
419+
* @return {boolean} `true` if given year is a leap year, `false` otherwise.
420420
*/
421421
function isLeapYear(year) {
422422
year = int(year);

src/v1/result-summary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import {isInt} from './integer';
2121

2222
/**
23-
* A ResultSummary instance contains structured metadata for a {Result}.
23+
* A ResultSummary instance contains structured metadata for a {@link Result}.
2424
* @access public
2525
*/
2626
class ResultSummary {

src/v1/result.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const DEFAULT_ON_COMPLETED = summary => {
3030
* A stream of {@link Record} representing the result of a statement.
3131
* Can be consumed eagerly as {@link Promise} resolved with array of records and {@link ResultSummary}
3232
* summary, or rejected with error that contains {@link string} code and {@link string} message.
33-
* Alternatively can be consumed lazily using <code>Result.subscribe()</code> function.
33+
* Alternatively can be consumed lazily using {@link Result#subscribe} function.
3434
* @access public
3535
*/
3636
class Result {
@@ -79,7 +79,7 @@ class Result {
7979

8080
/**
8181
* Waits for all results and calls the passed in function with the results.
82-
* Cannot be combined with the <code>Result.subscribe()</code> function.
82+
* Cannot be combined with the {@link Result#subscribe} function.
8383
*
8484
* @param {function(result: {records:Array<Record>, summary: ResultSummary})} onFulfilled - function to be called
8585
* when finished.

src/v1/session.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Session {
7272

7373
/**
7474
* Run Cypher statement
75-
* Could be called with a statement object i.e.: {text: "MATCH ...", parameters: {param: 1}}
75+
* Could be called with a statement object i.e.: `{text: "MATCH ...", parameters: {param: 1}}`
7676
* or with the statement and parameters as separate arguments.
7777
* @param {mixed} statement - Cypher statement to execute
7878
* @param {Object} parameters - Map with parameters to use in statement
@@ -167,7 +167,7 @@ class Session {
167167
* Transaction will automatically be committed unless the given function throws or returns a rejected promise.
168168
* Some failures of the given function or the commit itself will be retried with exponential backoff with initial
169169
* delay of 1 second and maximum retry time of 30 seconds. Maximum retry time is configurable via driver config's
170-
* <code>maxTransactionRetryTime</code> property in milliseconds.
170+
* `maxTransactionRetryTime` property in milliseconds.
171171
*
172172
* @param {function(tx: Transaction): Promise} transactionWork - callback that executes operations against
173173
* a given {@link Transaction}.
@@ -186,7 +186,7 @@ class Session {
186186
* Transaction will automatically be committed unless the given function throws or returns a rejected promise.
187187
* Some failures of the given function or the commit itself will be retried with exponential backoff with initial
188188
* delay of 1 second and maximum retry time of 30 seconds. Maximum retry time is configurable via driver config's
189-
* <code>maxTransactionRetryTime</code> property in milliseconds.
189+
* `maxTransactionRetryTime` property in milliseconds.
190190
*
191191
* @param {function(tx: Transaction): Promise} transactionWork - callback that executes operations against
192192
* a given {@link Transaction}.

src/v1/spatial-types.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ const POINT_IDENTIFIER_PROPERTY = '__isPoint__';
2222

2323
/**
2424
* Represents a single two or three-dimensional point in a particular coordinate reference system.
25-
* Created <code>Point</code> objects are frozen with {@link Object#freeze()} in constructor and thus immutable.
25+
* Created `Point` objects are frozen with `Object.freeze()` in constructor and thus immutable.
2626
*/
2727
export class Point {
2828

2929
/**
3030
* @constructor
3131
* @param {Integer|number} srid the coordinate reference system identifier.
32-
* @param {number} x the <code>x</code> coordinate of the point.
33-
* @param {number} y the <code>y</code> coordinate of the point.
34-
* @param {number} [z=undefined] the <code>y</code> coordinate of the point or <code>undefined</code> if point has 2 dimensions.
32+
* @param {number} x the `x` coordinate of the point.
33+
* @param {number} y the `y` coordinate of the point.
34+
* @param {number} [z=undefined] the `y` coordinate of the point or `undefined` if point has 2 dimensions.
3535
*/
3636
constructor(srid, x, y, z) {
3737
this.srid = assertNumberOrInteger(srid, 'SRID');
@@ -61,7 +61,7 @@ Object.defineProperty(Point.prototype, POINT_IDENTIFIER_PROPERTY, {
6161
/**
6262
* Test if given object is an instance of {@link Point} class.
6363
* @param {object} obj the object to test.
64-
* @return {boolean} <code>true</code> if given object is a {@link Point}, <code>false</code> otherwise.
64+
* @return {boolean} `true` if given object is a {@link Point}, `false` otherwise.
6565
*/
6666
export function isPoint(obj) {
6767
return (obj && obj[POINT_IDENTIFIER_PROPERTY]) === true;

0 commit comments

Comments
 (0)