Skip to content

Commit

Permalink
fix: update Readme examples and output the correct deprecation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lholmquist committed Aug 26, 2021
1 parent 9966675 commit 3ee7eb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A Node.js helper library for http://swapi.dev/ - the Star Wars API

const swapi = require('swapi-node');

swapi.getPerson(1).then((result) => {
swapi.people({ id: 1 }).then((result) => {
console.log(result);
});

Expand Down Expand Up @@ -54,7 +54,7 @@ Here is an example

There are some values that return a link. To make it easier to deal with these, there are corresponding getters for those properties.

For example, a call to `getPerson(1)` might return this json:
For example, a call to `people({id: 1})` might return this json:

{
"name": "Luke Skywalker",
Expand Down
10 changes: 5 additions & 5 deletions lib/swapi-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,27 @@ module.exports = {
return makeRequest('people' + (options_.id ? '/' + options_.id : '/'));
},
getStarship (options) {
deprecate('getPerson is deprecated. Use starships instead');
deprecate('getStarship is deprecated. Use starships instead');
const options_ = parseOptions(options);
return makeRequest('starships' + (options_.id ? '/' + options_.id : '/'));
},
getVehicle (options) {
deprecate('getPerson is deprecated. Use vehicles instead');
deprecate('getVehicle is deprecated. Use vehicles instead');
const options_ = parseOptions(options);
return makeRequest('vehicles' + (options_.id ? '/' + options_.id : '/'));
},
getFilm (options) {
deprecate('getPerson is deprecated. Use films instead');
deprecate('getFilm is deprecated. Use films instead');
const options_ = parseOptions(options);
return makeRequest('films' + (options_.id ? '/' + options_.id : '/'));
},
getSpecies (options) {
deprecate('getPerson is deprecated. Use species instead');
deprecate('getSpecies is deprecated. Use species instead');
const options_ = parseOptions(options);
return makeRequest('species' + (options_.id ? '/' + options_.id : '/'));
},
getPlanets (options) {
deprecate('getPerson is deprecated. Use planets instead');
deprecate('getPlanets is deprecated. Use planets instead');
const options_ = parseOptions(options);
return makeRequest('planets' + (options_.id ? '/' + options_.id : '/'));
}
Expand Down

0 comments on commit 3ee7eb8

Please sign in to comment.