Closed winniethefoo closed 5 years ago
pf
comes from the Pet Finder API module which is installed when you add the package to your package.json and run npm install
.
Can pf be any name or is it specific? I don't see pf defined in the Pet Finder API module. How do I know what to import when using someone elses API if its not documented?
Yes you can name it anything you want. The documentation is the Typescript definitions https://github.com/btholt/petfinder-client/blob/master/index.d.ts
So import { foo, bar, baz } from "bam";
means that bam is destructed where the modules are specifically imported.
This would allow me to call foo, bar and baz.
However if I say import foo from "bam";
i am importing all modules from bam and assigning it to a new const which is an object called foo even if a foo module exists in bam.
Which would then mean I would call foo.foo, foo.bar or foo.baz.
Is this understanding correct?
Is it possible a pull request could be made to update this in the documentation because I feel @btholt tutorials are very extremely beginner friendly to people of all levels of JavaScript but I was lost here on this specifically until you provided clarifications.
Thanks again @1Marc and @btholt
(Nevermind, just realised this is the code git and not the tutorial itself)
Good tip. Time permitting I can add info about module imports. @winniethefoo
Can you explain where the method pf is defined as I believe I don't really understand import?