Components Showcase

This page demoes the available components for creating tutorials

Code block

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const CategoryEncoder = require('./category')


class WeekendEncoder extends CategoryEncoder {

		constructor(opts) {
				super({
						w: opts.w,
						categories: ['weekday', 'weekend'],
				})
		}

		encode(date) {
				let dayOfWeek = date.getDay()
				let value = 'weekday'
				if (dayOfWeek === 0 || dayOfWeek === 6)
						value ='weekend'
				return super.encode(value)
		}

}

module.exports = WeekendEncoder