npm.io
1.2.8 • Published 6 years ago

factful.js

Licence
MIT
Version
1.2.8
Deps
3
Size
22 kB
Vulns
0
Weekly
0

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

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

Keywords