@laphilosophia/story-teller

1.0.0 • Public • Published

story teller

simple reader / teller module for story applications

const response = await fetch('your-api-address')
const json = await response.json()

const story = new StoryTeller({
  resource: json.data,
  config: {
    readTime: 238,
    speechTime: 183,
    pages: 10,
  },
  language: 'en',
})

const stats = story.stats()
console.log(stats)
/*
  stats: {
    words: number
    characters: string | number
  }
  times: {
    formatted: {
      speech: string
      read: string
    }
    raw: {
      read: number
      speech: number
    }
  }
*/

story.startReading((result) => {
  console.log(result)
})
/*
{
  story: string[],
  page: number,
  readingTime: 'n minutes and n seconds',
}
*/

Package Sidebar

Install

npm i @laphilosophia/story-teller

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.65 kB

Total Files

6

Last publish

Collaborators

  • laphilosophia