g0v/labor-standards-tw

Name: labor-standards-tw

Owner: g0v

Description: ??????????, Taiwan Labor Standards Act Library

Created: 2017-04-11 15:25:21.0

Updated: 2018-04-13 11:47:07.0

Pushed: 2018-01-15 01:59:40.0

Homepage:

Size: 510

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

labor-standards-tw

????????????????????????????????????????

Taiwan Labor Standards Act Library for calculating penalty, overtime wages, annual paid leaves & checking shift work schedule is legal or not.

??
????

?????? npm ???????

install g0v/labor-standards-tw --save

????? node.js ??????? require() ????????????????? webpack ??? import ?????

or Node.js
t {Labor, WorkTime} = require('labor-standards-tw')

or Webpack
rt {Labor, WorkTime} from 'labor-standards-tw'
Labor class

Labor ?????????????????????????????????????????????????

rt { Labor, Gender } from 'labor-standards-tw'

? 20 ??????? 2017/3/20 ?????? 24000 ?
t labor = new Labor()
r.setGender(Gender.FEMALE)
 .setAge(20)
 .onBoard(new Date(2017, 4, 20))
 .setMonthlySalary(24000)

Labor ???????? methods??????????? setter / getter ??????????????????????????????????????? methods ???? Result ???

rt { Labor, ChildLaborType } from 'labor-standards-tw'

t labor = new Labor().setAge(15)

??????????
result = labor.validateChildLabor()

?????? 44 ?????????????
ct(result.value.legal).eq(true)
ct(result.value.type).eq(ChildLaborType.CHILD_LABOR)
article = result.according[0]
ct(article.lawTitle).eq('?????')
ct(article.id).eq('44')

?????? 14 ?
lt = labor.setAge(14).validateChildLabor()

?
ct(result.value.legal).eq(false)

??????
ct(result.value.type).eq(ChildLaborType.ILLEGAL)

???? 44 ?
cle = result.violations[0]
ct(article.lawTitle).eq('?????')
ct(article.id).eq('44')

????????
. ?? 300,000 ??
. ?? 6 ????
. ???????
t penalty = article.penalize()
ct(penalty.article.id).eq('77')
ct(penalty.possibilities.length).eq(3)

?????????????? jsdoc ????? cucumber ? ????

????

????? node.js v6 LTS???????????????? node.js?????? nvm

????

?????? npm install ????????????? npm test ?????????

??????????? Visual Studio Code????????????? debugger; ???????????? Debug task?

??????? Labor.ts ??? retire() ?????? debugger ?????????????

re (date: Date): Result {
bugger; // ?????
nst result = new Result()

nst years = moment(date).diff(this._onboard, 'years')
nst retirement = (years >= 15 && this.getAge() >= 55) ||
                  (years >= 25) ||
                  (years >= 10 && this.getAge() >= 60)

sult.value.retirement = retirement
sult.according.push(new Article('?????', '53'))

turn result

?? Debug task ???????????????????

Screenshot for debugging

????

????????????????????????? issues ??????? issue?

??????????? Github issue ????????????? issues ?????

??????????? pull request ?????travis-ci ?????????? coding style ??????????????????????????????

?? cucumber ????????? test.md?

????
??

????? MIT ?? ?????????????????? MIT ???


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.