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
mridul037
@mridul037

const getR = async()=>(
await fetch("http://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=077fe507985744818b3f405349c79601")
).json();

(async ()=>{
const articles=(await getR()).articles;
articles.map(({title,description},index)=>{
(
value+index = title
description+index = description
)
}).join('')
})();

how to write value+ index
ajay yadav
@ajay7868

opentok.createSession(function (err, session) {
if (err) return console.log(err);

const token = session.generateToken({
    role: 'moderator',
    expireTime: (new Date().getTime() / 1000) + (1 * 24 * 60 * 60), // in one day
    data: 'name=ajay',
    initialLayoutClassList: ['focus']
});
return { sessionId: session.sessionId,token:token}

});
can any one tell me how to get these value in a variable ?

sgda021992
@sgda021992
can anyone tell me regex to check number is greater than equal to 6
i have tried enough but not working
i want regex only
pranaysaha-ps
@pranaysaha-ps
@sgda021992 Why do you want to use regex. It's heavy in terms of process, instead when you have the option of using >= and evaluate easily?
sgda021992
@sgda021992
screencapture-localhost-4200-courses-2020-08-12-19_11_54.png
i had used infinite scroller but items are not coming in row
can anyone tell me how can i achieve this
Ashokkumar
@Ashokkumar93
Hi
Using moment js how to get the current time of specific time zone in browser.
For suppose I’m in Singapore time zone, but I want to get current time of America/Los_Angeles.
Can some one helps me. Thanks
Jordan Harband
@ljharb
this isn't a general JS help channel, it's for airbnb's javascript style guide.
Shrugsy
@Shrugsy

Can anyone please explain this part of the airbnb style guide to me?
https://github.com/airbnb/javascript#arrays--mapping
It says:

4.6 Use Array.from instead of spread ... for mapping over iterables, because it avoids creating an intermediate array.

// bad
const baz = [...foo].map(bar);

// good
const baz = Array.from(foo, bar);

But I don't understand why you wouldn't instead do:

const baz = foo.map(bar);
I think I might understand it now. If it's already an array, foo.map(bar) is fine. If it's a non-array iterable, then use Array.from to prevent converting to an array just to use map
Jordan Harband
@ljharb
yep, that's right
Shrugsy
@Shrugsy
Is this still accurate?: https://github.com/airbnb/javascript#generators--nope
11.2 Don’t use generators for now.

Why? They don’t transpile well to ES5.
Jordan Harband
@ljharb
it's not well explained, but yes
generators transpile to need regenerator-runtime
which is slow and heavyweight
(and there's not many real use cases for generators anyways ime)
Shrugsy
@Shrugsy
Thanks, appreciate the extra info
Shrugsy
@Shrugsy
Are there plans for the React portion of the guide to be updated further? Given the way it refers to function components as stateless and only recommending them if you don't have state or refs, I feel like it hasn't been updated to reflect the introduction of hooks
https://github.com/airbnb/javascript/tree/master/react#class-vs-reactcreateclass-vs-stateless
Jordan Harband
@ljharb
it has indeed not been updated for that
Richard Sithole
@Sliqric7053

Hi there

I have an async function which I would like to convert to an Observable stream (using rxjs operators). The await calls must execute in the order they appear in the function.

async authenticateUser(profile: Profile): Promise<any> {

  let authCookie: any;



   try {

         authCookie = await getCookie();

    } catch (error) {

           console.error(error);

     }



   if (!authCookie || authCookie?.length < 1) {

            cancelAuthenticationCookieGet();

            throw {message: "login failed", status: -2};

      }

    await saveProfileAsync(profile);



    await storeCurrentAuthCookieAsync(authCookie);


    storeSessionStorage();



    await setPartitionSessionCookie(profile.url, authCookie);

}

Is there a clean way to accomplish the above?

Mile Mijatović
@mijatovicmile
Hi
I have one JavaScript specific question
If we have an array of 5 numbers, and the task is to pack their binary values into a single integer
How to do that , any solution for that?
Jordan Harband
@ljharb
this isn't a general js help channel, it's for airbnb's javascript styleguide.
Mile Mijatović
@mijatovicmile
Ok, never mind
Do you have an idea how to solve that ?
Jordan Harband
@ljharb
i don't know what you mean by "binary values"
are they all of fixed width?
Mile Mijatović
@mijatovicmile
@ljharb Why enzyme ?
I saw that you are contributor

description is :

Enzyme is a JavaScript Testing utility for React that makes it easier to test your React Components' output. You can also manipulate, traverse, and in some ways simulate runtime given the output.

Why we can't do that with just jest
too many yarn or npm packages can lead to enormous bundle size
Jordan Harband
@ljharb
jest is a test runner. Enzyme is a react testing library. You can use any test runner, but you have to use one - and none of them let you test react
and bundle size is irrelevant for tests
Mile Mijatović
@mijatovicmile
Yes, I understand
But I have one issue, because I created app with yarn create react-app ... and by default I got setupTests.js file with import '@testing-library/jest-dom/extend-expect';
I deleted all three default @testing-library... packages
I am not sure how to set up setupTests.js file according to the enzyme test runner instead of default @testing-library...
any advice will be appreciate
Jordan Harband
@ljharb
react-testing-library and enzyme are both react testing libraries. you'd need one or both, combined with something like jest
enzyme's repo has docs with a jest setup guide
Mile Mijatović
@mijatovicmile
Thank you
Bhargav yadati
@bhargavdt3
Any idea, How to get a left position of an element which is in iframe, and both iframe and parent document bodys are set with zoom : 1.2 and zoom 0.9
Vyacheslav
@Voronenko
c
s4cr
@s4cr
hello
tuerfight
@tuerfight
Hello everyone, I want to design a form to let user fills server settings but don't know how many settings would user fill, is there a good form data structure for this?(Using playframework scala)