1.2.0 • Published 4 years ago

gohome v1.2.0

Weekly downloads
45
License
MIT
Repository
gitlab
Last release
4 years ago

gohome

This project can calculate your actual work time and show you when you can go home. Your first run will save your start working time and the next run will load time from the saved previous time.

demo

coverage report npm npm npm

Installation:

npm i gohome -g

Example running:

gohome 8:00
gohome 08:00
gohome 12:11

You can use this package for your next solution like this:

const { gohome } = require('gohome')
const output = gohome(
	'8:00', // timeStartWork,
	8, // timeWorkMaxHours,
	6, // timeWorkMinHours,
	30, // timeLaunchMinutes
)

If you want define your current hours and minutes it is possible like this:

const { gohome } = require('gohome')
const output = gohome(
	'8:00', // timeStartWork,
	8, // timeWorkMaxHours,
	6, // timeWorkMinHours,
	30, // timeLaunchMinutes,
	10, // actual hours,
	0, // actual minutes,
)

If you want check your start working time before running gohome function you can use this:

const { gohome, isValidInput } = require('gohome')
const timeStartWork = '8:00'
const isValid = isValidInput(timeStartWork)

if (isValid) {
	gohome(
		timeStartWork, // timeStartWork,
		8, // timeWorkMaxHours,
		6, // timeWorkMinHours,
		30, // timeLaunchMinutes
	)
} else {
	console.error(`This start working time is not valid: ${timeStartWork}`)
}

Expected incorrect result will be show in your console like this:

alt 1

Expected correct result if you defined correct start working time:

alt 2

Expected correct result if you worked 6 hours:

alt 3

Expected correct result if you worked more than 8 hours:

alt 4

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

0.0.1

4 years ago

3.2.9

5 years ago

3.2.8

5 years ago

3.2.7

5 years ago

3.2.6

5 years ago

3.2.5

5 years ago

3.2.4

5 years ago

3.2.3

5 years ago

3.4.3

5 years ago

3.4.2

5 years ago

3.4.0

5 years ago

3.2.0

5 years ago

3.4.1

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

6 years ago

3.0.9

6 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.1.0

4 years ago

1.0.2

6 years ago

1.0.1

4 years ago

0.1.1

6 years ago

0.1.0

6 years ago

1.0.0

4 years ago