AlexGustafsson / itslearning

A fully async API written in ES6 for the It's Learning platform
https://alexgustafsson.github.io/itslearning/
11 stars 3 forks source link

Change match[0] to matches[0] in "Searching for an organisation" #3

Closed elisaado closed 7 years ago

elisaado commented 7 years ago

Would otherwise give "ReferenceError: match is not defined" (I'm terrible with naming changes)

AlexGustafsson commented 7 years ago

Great catch!

Would you like to fix the root cause of the problem?

I've used Slate to generate the static documentation for the GitHub Pages. The code and documentation source used to generate the page is available in the slate-branch.

The typo you found originated from the source documentation.

ItsLearning.searchOrganisation('Blekinge Tekniska Högskola')
  .then(matches => {
    console.log(`A match was: ${match[0].name} with the id ${match[0].id}`);
  }).catch(error => {
    // there was an error with the request
  });

I'd rather see the snippet being changed to something like the following:

ItsLearning.searchOrganisation('Blekinge Tekniska Högskola')
  .then(matches => {
    console.log(`A match was: ${matches[0].name} with the id ${matches[0].id}`);
  }).catch(error => {
    // there was an error with the request
  });

(Use of matches consistently. This is to ensure readability)

When the source has been changed, a re-build has to be made. Right now Linux and macOS are supported platform. See Slate's README for more information.

The generated site will be available in the build folder. The content of said folder should then be made the content of the gh-pages branch.

So to sum up:

  1. Fix the root cause of the issue in the slate branch
  2. Build the static site and add to gh-pages
elisaado commented 7 years ago

Yeah sure, shouldn't be too hard :D I'll take a look.

AlexGustafsson commented 7 years ago

Closing as the changes discussed were made in seperate pull requests (#4 & #5).