No Description

point.js 600B

1234567891011121314151617181920
  1. const nzhhk = require('nzh/hk')
  2. export function ponitTransform(dealingRecord) {
  3. let { point1, point2, totalPoints } = dealingRecord
  4. point1 = Number(point1)
  5. point2 = Number(point2)
  6. totalPoints = Number(totalPoints)
  7. if (point1 === 0 && point2 === 0) {
  8. return `白板對`
  9. } else if (point1 === point2) {
  10. return `對子`
  11. } else if (point1 + point2 === 10) {
  12. return `尻`
  13. } else if (point1 === 0 || point2 === 0) {
  14. return `${point1 === 0 ? nzhhk.encodeS(`${point2}`) : nzhhk.encodeS(`${point1}`)}點半`
  15. } else {
  16. return `${nzhhk.encodeS(`${totalPoints}`)}點`
  17. }
  18. }