Gets the name of a number, even if it's stupidly big. Supersedes TheoryOfNekomata/number-name.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

18 rindas
436 B

  1. const { default: getNumberName } = require('../packages/core')
  2. const fs = require('fs')
  3. const path = require('path')
  4. const main = async () => {
  5. const ws = fs.createWriteStream(path.resolve(__dirname, 'count-to-one-million.out.csv'))
  6. ws.write('number,name\n')
  7. for (let i = 0; i <= 1000000; i++) {
  8. if (i % 1000 === 0) {
  9. console.log(i)
  10. }
  11. ws.write(i + ',' + getNumberName(i) + '\n')
  12. }
  13. ws.close()
  14. }
  15. void main()