add recursive (of)

This commit is contained in:
Quentin Leonetti 2019-07-15 22:34:25 +02:00
parent e8bc9d0ddc
commit b8736c1cbc
2 changed files with 5 additions and 2 deletions

View File

@ -184,8 +184,10 @@ function Library (ronin) {
//
this.of = (h, k) => {
return h[k]
this.of = (h, ...keys) => {
return keys.reduce((acc, key) => {
return acc[key]
}, h)
}
this.theme = (variable, el = document.documentElement) => {

View File

@ -57,4 +57,5 @@
; Interop
(test "interop" ((of (of js "Math") "max") 2 4) 4)
(test "recursive key selector" ((of js "Math" "max") 2 4) 4)
)