diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-22 20:04:46 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-25 12:28:15 +0300 |
commit | 0646eda4fc0affb98e13c30acb522e63b7fd6dde (patch) | |
tree | 078209f50b044e24ea2c72cbbe7dca6e34bb7e25 /lib/internal/child_process | |
parent | 35c6e0cc2b56a5380e6808ef5603ecc2b167e032 (diff) |
lib: flatten access to primordials
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib/internal/child_process')
-rw-r--r-- | lib/internal/child_process/serialization.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/internal/child_process/serialization.js b/lib/internal/child_process/serialization.js index 1381f299265..48b6d7ffe00 100644 --- a/lib/internal/child_process/serialization.js +++ b/lib/internal/child_process/serialization.js @@ -1,6 +1,9 @@ 'use strict'; -const { JSON } = primordials; +const { + JSONParse, + JSONStringify, +} = primordials; const { Buffer } = require('buffer'); const { StringDecoder } = require('string_decoder'); const v8 = require('v8'); @@ -104,14 +107,14 @@ const json = { } else { chunks[0] = channel[kJSONBuffer] + chunks[0]; for (let i = 0; i < numCompleteChunks; i++) - yield JSON.parse(chunks[i]); + yield JSONParse(chunks[i]); channel[kJSONBuffer] = incompleteChunk; } channel.buffering = channel[kJSONBuffer].length !== 0; }, writeChannelMessage(channel, req, message, handle) { - const string = JSON.stringify(message) + '\n'; + const string = JSONStringify(message) + '\n'; return channel.writeUtf8String(req, string, handle); }, }; |