Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 568B

1234567891011121314151617
  1. 'use strict'
  2. const to12Digit = (id) => {
  3. if ('string' !== typeof id) throw new Error('ID must be a string.')
  4. if (id.length === 9) return id.slice(0, 1) + '000' + id.slice(1)
  5. if (id.length === 7) return id.slice(0, 1) + '00000' + id.slice(1)
  6. return id
  7. }
  8. const to9Digit = (twelve) => {
  9. if ('string' !== typeof twelve) throw new Error('ID must be a string.')
  10. if (twelve.length === 12) return twelve.slice(0, 1) + twelve.slice(4)
  11. if (twelve.length === 7) return twelve.slice(0, 1) + '00' + twelve.slice(1)
  12. return twelve
  13. }
  14. module.exports = {to12Digit, to9Digit}