Files

1.9 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d7fb4367417b2b2512bfd Aggiungere parole chiave al tuo package.json 2 301526 add-keywords-to-your-package-json

--description--

Il campo keywords è dove puoi descrivere il tuo progetto usando le parole chiave correlate. Qui un esempio:

"keywords": [ "descriptive", "related", "words" ],

Come puoi vedere, questo campo è strutturato come una serie di stringhe tra virgolette doppie.

--instructions--

Aggiungi un array di stringhe adatte al campo keywords nel file package.json del tuo progetto.

Una delle parole chiave dovrebbe essere "freecodecamp".

--hints--

package.json dovrebbe avere una chiave "keywords" valida

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/package.json').then(
    (data) => {
      var packJson = JSON.parse(data);
      assert(packJson.keywords, '"keywords" is missing');
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

il campo "keywords" dovrebbe essere un Array

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/package.json').then(
    (data) => {
      var packJson = JSON.parse(data);
      assert.isArray(packJson.keywords, '"keywords" is not an array');
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

"keywords" dovrebbe includere "freecodecamp"

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/package.json').then(
    (data) => {
      var packJson = JSON.parse(data);
      assert.include(
        packJson.keywords,
        'freecodecamp',
        '"keywords" does not include "freecodecamp"'
      );
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

--solutions--

/**
  Backend challenges don't need solutions, 
  because they would need to be tested against a full working project. 
  Please check our contributing guidelines to learn more.
*/