This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Direction = { North: 0, South: 1, East: 2, West: 3 }; | |
class Room { | |
constructor(roomNo) { | |
this.no = roomNo; | |
this.sides = new Array(4); | |
} | |
setSide(direction, mapSite) { | |
this.sides[direction] = mapSite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Direction = { North: 0, South: 1, East: 2, West: 3 }; | |
class Room { | |
constructor(roomNo) { | |
this.no = roomNo; | |
this.sides = new Array(4); | |
} | |
setSide(direction, mapSite) { | |
this.sides[direction] = mapSite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import(base.css) layer(base); | |
@layer base { | |
.text { | |
color: green; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 定義一個名字叫做 base 的 cascade layer */ | |
@layer base { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Box { | |
constructor() { | |
this.price = 50; | |
this.products = []; | |
} | |
get totalPrice() { | |
const productsTotalPrice = this.products.reduce( | |
(totalPrice, product) => totalPrice + product.totalPrice, 0 | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Box { | |
// 略 | |
get totalPrice() { | |
const productsTotalPrice = this.products.reduce( | |
(totalPrice, product) => totalPrice + product.totalPrice, 0 | |
); | |
return productsTotalPrice + this.price; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product { | |
constructor(name, price) { | |
this.name = name; | |
this.price = price; | |
} | |
get totalPrice() { | |
return this.price; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Box { | |
// 略 | |
get totalPrice() { | |
const productsTotalPrice = this.products.reduce( | |
(totalPrice, product) => { | |
if (product.constructor === Bag) { | |
return totalPrice + product.totalPrice; | |
} | |
return totalPrice + product.price |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Box { | |
constructor() { | |
this.price = 50; | |
this.products = []; | |
} | |
get totalPrice() { | |
const productsTotalPrice = this.products.reduce( | |
(totalPrice, product) => totalPrice + product.price, 0 | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-restricted-syntax */ | |
/* eslint-disable no-await-in-loop */ | |
/* eslint-disable guard-for-in */ | |
import * as yup from 'yup'; | |
import { useState } from 'react'; | |
const useForm = (validationConfig, form) => { | |
const initialValidateResult = {}; | |
Object.keys(validationConfig).forEach((validationKey) => { | |
initialValidateResult[validationKey] = { |