factful.js
TypeScript icon, indicating that this package has built-in type declarations

1.2.8 • Public • Published

Factful.js

A Package which can give you Random Facts, Random Nasa Images in an easy way!

Index

  • Importing Module
  • Getting Random Facts
  • Getting Random Nasa Image
  • Typescript Example

Links

Quick Example

1. Importing Module

// Import Modules
const factful = require('factful.js')

2. Getting Facts

const facts = factful.fact()

// Getting Random Fact from Random Cateogary
console.log(facts.all)

// Getting Random Fact from a Paticular Cateogary
// Current Cateogaries: emoji, space, cat, dog, covid, computer, food
console.log(facts.emoji)
console.log(facts.space)
console.log(facts.cat)
console.log(facts.dog)
console.log(facts.covid)
console.log(facts.computer)
console.log(facts.food)

3. Getting Random Nasa Image

// Will return you the Image URL not the Image File!
console.log(factful.nasa())

4. Typescript Example

// Import package
import * as factful from 'factful.js'

// Getting Random fact
const facts = factful.fact()

// Getting Random Fact from Random Cateogary
console.log(facts.all)

// Getting Random Fact from a Paticular Cateogary
// Current Cateogaries: emoji, space, cat, dog, covid, computer, food
console.log(facts.emoji)
console.log(facts.space)
console.log(facts.cat)
console.log(facts.dog)
console.log(facts.covid)
console.log(facts.computer)
console.log(facts.food)

// Will return you the Image URL not the Image File!
console.log(factful.nasa())

© Science Spot | Decimal Development - 2020

Package Sidebar

Install

npm i factful.js

Homepage

README.md

Weekly Downloads

4

Version

1.2.8

License

MIT

Unpacked Size

22.7 kB

Total Files

9

Last publish

Collaborators

  • science_spot_codes