Using "require"

What’s the difference between these:

const assert = require(‘assert’);
const request = require(‘supertest’);

and these:

const {assert} = require(‘chai’);
const {jsdom} = require(‘jsdom’);

What do the curly braces do?

When do I need to use them?

I think I may have found the answer. I found this on StackOverflow. This leads me to believe that

const (assert) = require(‘chai’);

is equivalent to

const assert = require(‘chai’).assert;

This means the new “assert” variable I’m creating will be assigned the value of only the .assert portion of the chai module instead of the whole thing. Whereas

const assert = require(‘assert’);

assigns the value of assert to the entire assert module included within Node.

So with chai, there are a few different styles you can use for setting up your test expectations, but the way it’s declared above, we will only have access to the set of functions within the ‘assert’ style.

Please correct me if I’m still wrong on this.