This file contains hidden or 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
// 0. ๊ณตํต๋ชจ๋ | |
const EMPTY = {}; | |
const err = message => { throw new Error(message); }; | |
const validateObj = (obj) => { | |
if (typeof obj !== 'object') err(`Invalid type: ${String(obj)} ${typeof obj}`); | |
}; |
This file contains hidden or 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 { renderHook } from "@testing-library/react-hooks/dom"; | |
import useInterval from "./useInterval"; | |
jest.useFakeTimers(); | |
jest.spyOn(globalThis, "setInterval"); | |
jest.spyOn(globalThis, "clearInterval"); | |
afterEach(() => { | |
jest.clearAllMocks(); | |
}); |
This file contains hidden or 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 arr = [ | |
{ id: 1, text: "abc" }, | |
{ id: 2, text: "def" }, | |
{ id: 3, text: "ghi" }, | |
]; | |
const Map = ({ list, children }) => <>{list.map((el) => children(el))}</>; | |
const Join = ({ separator, children }) => { | |
// const [Frag] = React.Children.toArray(children); |
This file contains hidden or 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 java.util.* | |
val trim = """[^.\d-+*()/]""".toRegex() | |
fun trim(v: String): String = v.replace(trim, "") | |
val MtoPM = """(?<!^|[*/(])-""".toRegex() | |
fun repMtoPM(v: String): String = v.replace(MtoPM, "+-") |