Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need to get href?

JavaScript
console.log(object);
object {
  [Symbol(connect-options)]: {
    rejectUnauthorized: true,
    ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
    checkServerIdentity: [Function: checkServerIdentity],
    minDHSize: 1024,
    protocol: 'https:',
    hostname: 'login.xecurify.com',
    hash: '',
    search: '?response_type=code&client_id=AGQjepKEWMeSPwM&redirect_uri=https://bing.com&scope=openid&state=aSdfgHjk',
    pathname: '/moas/broker/login/oauth/219048',
    path: null,
    href: 'https://login.xecurify.com/moas/broker/login/oauth/219048?response_type=code&client_id=AGQjepKEWMeSPwM&redirect_uri=https://bing.com&scope=openid&state=aSdfgHjk',
    method: 'GET',
    _defaultAgent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object],
      requests: {},
      sockets: [Object],
      freeSockets: {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    port: 443,
    host: 'login.xecurify.com',
    servername: 'login.xecurify.com',
    _agentKey: 'login.xecurify.com:443::::::::::::::::::',
    encoding: null,
    singleUse: true
  }
}


What I have tried:

JavaScript
console.log(object['connect-options'])
console.log(object.Symbol('connect-options'))
console.log(object.connect-options)
console.log(object[Symbol('connect-options')])
console.log(object[Symbol(connect-options)])

None worked.
Posted
Updated 31-Jul-20 21:40pm
v2
Comments
Richard MacCutchan 31-Jul-20 3:57am    
"None worked."
We can not guess what that is supposed to mean. Please use the Improve question link above and add a proper explanation of your problem.

1 solution

Hi,

You can check my written article about Basics of JavaScript Symbols[^]

I think you need to have the reference to the symbol in order for you to get the value.

Here are the steps:
1. Get the reference. Note: Just make sure about the index.
e.g.
JavaScript
let symbol = Object.getOwnPropertySymbols(object)[0]; //let's assume this is Symbol(connect-options) 

2. Once you have the reference, you can use that reference as a token property.
e.g.
JavaScript
object[symbol]; // you'll get the entire value of the symbol
console.log(object[symbol]);

If you are still confused, you can reference the example below.
JavaScript
const fruits = { [Symbol("myFruits")] : { favorite: true, color: "yellow", name: "mango"}  };

let symbolReference = Object.getOwnPropertySymbols(fruits)[0]; //zero because we only have one Symbol within the array.

console.log(fruits[symbolReference]);


I hope this helps you out.

Cheers,
Jin
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900