mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
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>
This commit is contained in:
parent
35c6e0cc2b
commit
0646eda4fc
117 changed files with 1317 additions and 943 deletions
|
@ -23,7 +23,10 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { Object } = primordials;
|
||||
const {
|
||||
ObjectCreate,
|
||||
ObjectKeys,
|
||||
} = primordials;
|
||||
|
||||
const { Buffer } = require('buffer');
|
||||
const {
|
||||
|
@ -167,7 +170,7 @@ function stringify(obj, sep, eq, options) {
|
|||
}
|
||||
|
||||
if (obj !== null && typeof obj === 'object') {
|
||||
const keys = Object.keys(obj);
|
||||
const keys = ObjectKeys(obj);
|
||||
const len = keys.length;
|
||||
const flast = len - 1;
|
||||
let fields = '';
|
||||
|
@ -233,7 +236,7 @@ function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
|
|||
|
||||
// Parse a key/val string.
|
||||
function parse(qs, sep, eq, options) {
|
||||
const obj = Object.create(null);
|
||||
const obj = ObjectCreate(null);
|
||||
|
||||
if (typeof qs !== 'string' || qs.length === 0) {
|
||||
return obj;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue