« first day (3809 days earlier)      last day (1364 days later) » 

02:18
@makadev Private fields are supported on my current chrome version
Have been for months
used em on several previous projects
 
4 hours later…
06:15
hello guys, am online any body we can have a chat
 
2 hours later…
07:54
 
1 hour later…
user13780186
08:54
How set the breakline on matches?

for example
matches(
          /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/,
          `Must contain 8 characters,\n At least one (1) uppercase, one (1) lowercase, one (1) Number[\n] and one special case character`
        )
13:08
@MRS1367 are you here
@Orhan maybe you can read here: strongloop.com/strongblog/…
@MuhammadIrva Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
2 hours later…
15:08
@Orhan they are more or less the same. The biggest difference is how this is handled. If you have code like$(this)in jQuery, it's not going to work. Although in most cases you can use something like $(e.target) if you take an event as an argument.
600
Q: Are 'Arrow Functions' and 'Functions' equivalent / interchangeable?

Felix KlingArrow functions in ES2015 provide a more concise syntax. Can I replace all my function declarations / expressions with arrow functions now? What do I have to look out for? Examples: Constructor function function User(name) { this.name = name; } // vs const User = name => { this.name...

hello house
anybody home
 
1 hour later…
16:27
Hi everyone
@zabop Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Javascript noob here, but trying to learn fast
I am reading this documentation: npmjs.com/package/node-binance-api
It has this bit:
binance.openOrders(false, (error, openOrders) => {
console.info("openOrders()", openOrders);
});
(this is from the "Get list of all open orders" part)
how could I get the openOrders array into a variable outside this function?
some other parts of my code rely on the length of this array
so while its useful to get it printed to console, its not really my aim
@zabop your best option is to convert this to a promise, so you can await it. Here is the background but you don't have to do the work yourself, there is util.promisify on Node.js
const util = require('util');

/* ... */

const orders = util.promisify(binance.openOrders);
const openOrders = await orders(false);
I think you can also use Bluebird for this. It also has a promisify functionality but also a promisifyAll, so you can convert all the methods into returning promises.
16:43
Thank you!
It returns this:
const openOrders = await orders(false);
^^^^^
SyntaxError: await is only valid in async function
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
Yeah...what it says. You need to have an async function in order to use await in it.
@zabop Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
this was the code
oh ok
You can do an async IIFE with (async() => { /* put any code that uses await here*/})()
But be aware that you cannot get the value "out" of there. It just helps with being able to put an await in.
16:46
great!
trying it...
wait, it also seems that Binance has a promise API. All methods start with futures. So you can also use await binance.futuresOpenOrders(false) without using util.promisify.
ah alright
yeah I had this code:
const asyncOpenOrders = (async() => {binance.openOrders})()
const orders = util.promisify(asyncOpenOrders);
const openOrders = await orders(false);
but same error message
looking into promisify...
It would be
(async() => {
  const openOrders = await binance.futuresOpenOrders(false);
  /* use `openOrders` here */
})()
awesome
(async() => {
  const openOrders = await binance.futuresOpenOrders(false);
  console.log("HelloWorld")
})()
outputs HelloWorld as expected :)
now lets see some more complicated issues...
(async() => {
  const openOrders = await binance.futuresOpenOrders(false);
  console.log(openOrders)
})()
this outputs:
[Object: null prototype] {
  code: -2015,
  msg:
   'Invalid API-key, IP, or permissions for action, request ip: 35.232.103.19' }
looking into why this could be, the API key worked for other purposes so fairly confident but checking that too...
yeah, API key works for other requests (such as limit orders)
works! Just need to delete the "futures" part!
(as I'm concerned with the spot trading not the futures trading)
Thank you for your help!
17:15
Oh, my bad then. I didn't realise "futures" is a finance thing. In the programming world "future" is sort of like a promise - another way to handle asynchronous tasks.
I assumed that futureOpenOrders is openOrders but a "future"/promise. My apologies.
no worries!
the part I don't get is: how to get the returned value (or some function of it) outside the async-await bit
This works like a charm:
@zabop Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
(async() => {
  const openOrders = await binance.openOrders(false);
  console.log(openOrders.length)
})()
but another function would need this value
I have tried a few things
for example:
let OO =
(async() => {
  const openOrders = await binance.openOrders(false);
  return openOrders.length
})()
console.log(OO)
Output:
Promise { <pending> }
 
3 hours later…
20:02
Put all of your code in the async IIFE. Just don't have any code outside. That's the easiest route. Otherwise, you need to use the promise API to deal with the value but I think await is simpler to deal with.
(async() => {
  /* all code that deals with async values goes in here */
})()
Put your imports before this and have no code after it.
20:38
How in Hastur's name does one create a Chrome extension with PHP code in it which also somehow accesses a MySQL database?

« first day (3809 days earlier)      last day (1364 days later) »