Transcript from the "Creating the Library Solution" Lesson
>> Kent C. Dodds: Let's quickly review the solution so we're all on the same page. So what we're doing here, actually, I'm gonna go ahead and check out the next branch, and we'll review that solution, because that's what we're gonna have going forward, cuz it might've been a slightly different. Yeah, of course, use strict, because we gotta do that when we're just in ES5 land, although this is Node 6, so we're actually in ES6 land here, but yeah.
[00:00:30] [COUGH] So a unique random array, we're pulling that from the unique random array module, which was basically its whole purpose is to take an array and give you back a function you can call to get a random item out of that array. So this is micro-libraries to the max, but it's nice because now we don't have to test of our functionality around a function to get a random item out of an array, which is cool.
[00:00:54] Then we also get starWarsNames from the .json file, our starwars-names.json. So this is all running in node, we're not doing anything with the browser yet, and so we can just pull that right from the file system. And then we export an object with an all property and a random property so that we can use those, and then by running node, we can simply require("_/src, which will default to the index, and then we'll say random, and we get a random Star Wars name, and we can say all, and get all the characters.
[00:01:32] So that is that for actually creating the library. We're not gonna add any more functionality, really. Well when we start transplanting with ES6, then we'll start playing around with some ES6 features, but, yeah, for now this is pretty much it. Maybe a little anticlimactic, but it's a macro-library, so there you.
[00:01:54] I'm not teaching you how to make a Star Wars names library, I'm teaching you how to make a library, so hopefully this is sufficient.