-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
66 lines (48 loc) · 1.61 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="module">
import * as Metho from "./metho.js"
const first = Metho.addWithParams(
String.prototype,
function first(count=1) {
return this.slice(0, count)
}
)
console.log("World"[first])
console.log("World"[first(3)])
// const hexxy = Symbol('hexxy')
// const hex = Metho.add(Number.prototype, function hex() { return this.toString(16) }, {useSymbol: hexxy})
// const oct = Metho.add(Number.prototype, function oct() { return this.toString(8) }, {symbolName:'octal', register:true})
// const to = Metho.add(
// Number.prototype,
// function(end, {step} = {step: this<=end?1:-1}) {
// let arr = [], i, d = end>this
// for (i=+this; d?(i<=end):(i>=end); i+=step) arr.push(i)
// return arr
// }
// )
// console.log(254[hex])
// console.log(3[to(9)])
// const multiFunc = function(t) {
// return this[Metho.data] + ' --- ' + t
// }
// Array.prototype[Metho.data] = "array"
// String.prototype[Metho.data] = "string"
// const multi = Metho.add([Array.prototype, String.prototype], multiFunc, {symbolName:"kumquat", register:true})
// console.log(`Registered (hex): ${Metho.registered('hex')?.toString()}`)
// console.log(`Registered (octal): ${Metho.registered('octal')?.toString()}`)
// console.log(`Registered (kumquat): ${Metho.registered('kumquat')?.toString()}`)
// console.log(hex)
// console.log(oct)
// console.log('Jon'[multi(111)])
// console.log([][multi(222)])
// console.log(multi.targets)
// window.ddd = multi
</script>
</body>
</html>