by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 08:18
    FieryCod commented #1379
  • Jan 30 2019 10:01
    atif089 commented #1379
  • Jan 30 2019 10:01
    atif089 commented #1379
  • Jan 30 2019 10:01
    atif089 commented #1379
  • Jan 30 2019 04:11
    tclindner opened #1998
  • Jan 28 2019 05:21

    ljharb on master

    [eslint config] [base] [patch] … [eslint config] [patch] extend … Merge pull request #1996 from r… (compare)

  • Jan 28 2019 05:21
    ljharb closed #1996
  • Jan 28 2019 04:50
    ljharb synchronize #1996
  • Jan 27 2019 21:45
    ljharb closed #1997
  • Jan 27 2019 21:45

    ljharb on master

    [editorial] [react] fix typo [eslint config] [*] [deps] upda… (compare)

  • Jan 27 2019 21:39
    ljharb synchronize #1997
  • Jan 27 2019 21:39
    ljharb labeled #1997
  • Jan 27 2019 21:39
    ljharb labeled #1997
  • Jan 26 2019 18:14
    ljharb labeled #1996
  • Jan 26 2019 18:14
    ljharb labeled #1996
  • Jan 26 2019 18:13
    ljharb synchronize #1996
  • Jan 26 2019 18:05
    ljharb commented #1996
  • Jan 26 2019 08:55
    telmen opened #1997
  • Jan 24 2019 19:37
    peteclark3 commented #1689
  • Jan 24 2019 17:25
    ljharb commented #747
Mile Mijatović
@mijatovicmile
WTF
Jordan Harband
@ljharb
relax, i was asleep.
I’m not sure which two examples you’re referring to
Mile Mijatović
@mijatovicmile
Never mind
Another question about async code execution
function trackUserHandler() {
  navigator.geolocation.getCurrentPosition(
    (position) => {
      setTimeout(() => {
        console.log('Position ', position);
      }, 2000);
    },
    (error) => console.log(error)
  );
  /**
   * This line will run before we print
   * current position or throw an error
   */
  setTimeout(() => {
    console.log('Timer done');
  }, 1000);
  console.log('Getting position');
}

button.addEventListener('click', trackUserHandler);
if I have this code
in this case, our stack is empty
<anonymous>
right ?
when we click on the button, Getting position will be executed immediately
and other callbacks tasks will be registered as to do
?
Mile Mijatović
@mijatovicmile
again very useful answer, thank you very much
this group is useless or what, noone wants to discuss
Jordan Harband
@ljharb
yes, that seems right
@mijatovicmile RELAX. chatting on the internet is async. you might not get a response for 24 hours, and that is ok
you're not paying anyone for their time, so you don't get to make demands on it. relax.
Mile Mijatović
@mijatovicmile
Ok
Jordan Harband
@ljharb
this isn't even a help channel, it's a channel for airbnb's javascript styleguide.
so you're not even asking in the right place
Mile Mijatović
@mijatovicmile
We don't have JavaScript channel then
this is the one and only
Jordan Harband
@ljharb
yes, gitter is primarily for repos, not topics.
there's a JS channel on freenode IRC tho.
Mile Mijatović
@mijatovicmile
What's that
Jordan Harband
@ljharb
what, irc?
it's the thing that predates slack/gitter/discord/etc by decades
Mile Mijatović
@mijatovicmile
freenode IRC
Jordan Harband
@ljharb
freenode is a specific IRC network
i'm sure you can google some tutorials
Jordan Harband
@ljharb
anyone who has eslint v7 questions, please see airbnb/javascript#2223
Scott Ball
@scotttball
@ljharb you should just have a bot post "This isn't a help channel, it's a channel for airbnb's javascript styleguide." lol
Jordan Harband
@ljharb
it's already the welcome message, people just don't read
Mayur K
@Tensai66
so i'm looking at the style guide, if i had like a ternary statement such as :
node !== undefined ? 0 : node.item
is this not good? because the reader of the code might not understand what the 0 stands for, should I be declaring this as a const variable somewhere, it just seems weird. i'm lookin at 13.4 where it says to assign variables where you need them. i don't exactly need it but i think it'd make it more readable right?
Jordan Harband
@ljharb
yes, that seems like 0 should be a constant
Mayur K
@Tensai66
ok sounds good thanks, do you think it's clearer to group all constants associated with something into an object that can be accessed instead? i couldn't find anything about that in style guide, but not sure if that's really a style guide question either
Jordan Harband
@ljharb
sure, that's fine
Mayur K
@Tensai66
awesome thanks, also i'm looking at the functions 7.1, but the examples throughout the doc use regular function declarations? i'm a little confused am i interpreting this incorrectly
vinayaktitti2015
@vinayaktitti2015

Hi all, how to check price2 > price1 using for loop? I have used array.push to store values but array values showing undefined.

expected
price 2 > price 1
price 3 > price 2
price 4 > price 3

 cy.get(orderCard).find('.kbbrUi').then(listing => {
            const listcount = Cypress.$(listing).length;
            console.log('count', listcount);
            var price_array = [];
            for (var i = 1; i < listcount; i++) {
                cy.get(orderValue).eq(i).invoke('text').then((label2) => {
                    const price = label2.replace(/[$]+/g, '');
                    //const price_2_int = parseInt(price_2);
                    console.log('price_2_int', price);
                    price_array.push(price);

                })
            }

          for (var j = 0; j <= price_array.length; j++) {
                        for (var k = 1; k < j; k++) {
                            expect(price_array[k]).to.be.greaterThan(price_array[j])
                        }
                    }
        })
Jordan Harband
@ljharb
don't use loops
in this case, you want to .map over the list, and get an array of promises, and Promise.all it
vinayaktitti2015
@vinayaktitti2015
can plz share sample snippet
Jordan Harband
@ljharb
so, somehow get Cypress.$(listing) into a real array, and then:
vinayaktitti2015
@vinayaktitti2015
ok will try that, thanks
Jordan Harband
@ljharb
const promises = arr.map(async (item) => { const label2 = await item.invoke('text'); const price = blah; return price; }); Promise.all(promises).then((prices) => { blah });
something like that
replace the "blah" with your own stuff
vinayaktitti2015
@vinayaktitti2015
got it now 👍
vinayaktitti2015
@vinayaktitti2015

Hi guys, how to check Date.parse(d2) > Date.parse(d1)? I am getting data as below, could anyone plz help

data input:
Mon Jun 01 10:00 AM
Tue Jun 01 10:00 PM
Thr Jun 03 9:00 AM
Sat Jun 05 11:00 AM

expected:

Tue Jun 01 10:00 PM > Mon Jun 01 10:00 AM

Thr Jun 03 9:00 AM > Tue Jun 01 10:00 PM