Liking cljdoc? Tell your friends :D

applied-science.js-interop

cljs

A JavaScript-interop library for ClojureScript.

A JavaScript-interop library for ClojureScript.
raw docstring

applyclj/s≠

clj
(apply obj k args)
cljs
(apply obj k arg-array)

Apply function k of obj, which is bound as this.

(j/apply o :someFunction #js [arg1 arg2])
Apply function `k` of `obj`, which is bound as `this`.

```
(j/apply o :someFunction #js [arg1 arg2])
```
source (clj)source (cljs)raw docstring

assoc!clj/s≠

clj
(assoc! obj & keyvals)
cljs
(assoc! obj & pairs)

Sets key-value pairs on obj, returns obj.

(j/assoc! o :foo 10)
(j/assoc! o .-foo 10)
Sets key-value pairs on `obj`, returns `obj`.

```
(j/assoc! o :foo 10)
(j/assoc! o .-foo 10)
```
source (clj)source (cljs)raw docstring

assoc-in!clj/s≠

clj
(assoc-in! obj ks v)
cljs
(assoc-in! obj [k & ks] v)

Mutates the value in a nested object structure, where ks is a sequence of keys and v is the new value. If any levels do not exist, objects will be created.

(j/assoc-in! o [:foo :goo] 10)
(j/assoc-in! o [.-foo .-goo] 10)
Mutates the value in a nested object structure, where ks is a
sequence of keys and v is the new value. If any levels do not
exist, objects will be created.

```
(j/assoc-in! o [:foo :goo] 10)
(j/assoc-in! o [.-foo .-goo] 10)
```
source (clj)source (cljs)raw docstring

callclj/s≠

(call obj k & args)
cljs

Call function k of obj, which is bound as this.

(j/call o :someFunction arg1 arg2)
Call function `k` of `obj`, which is bound as `this`.

```
(j/call o :someFunction arg1 arg2)
```
source (clj)source (cljs)raw docstring

contains?clj/s≠

(contains? obj k)
cljs

Returns true if obj contains k.

(j/contains? o :k)
(j/contains? o .-k)
Returns true if `obj` contains `k`.

```
(j/contains? o :k)
(j/contains? o .-k)
```
source (clj)source (cljs)raw docstring

getclj/s≠

(get obj k)
(get obj k not-found)
cljs

Returns the value mapped to key, not-found or nil if key not present.

(j/get o :k)
(j/get o .-k)
Returns the value mapped to key, not-found or nil if key not present.

```
(j/get o :k)
(j/get o .-k)
```
source (clj)source (cljs)raw docstring

get-inclj/s≠

(get-in obj ks)
(get-in obj ks not-found)
cljs

Returns the value in a nested object structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied.

(j/get o :k :fallback-value)
(j/get o .-k :fallback-value)
Returns the value in a nested object structure, where ks is
a sequence of keys. Returns nil if the key is not present,
or the not-found value if supplied.

```
(j/get o :k :fallback-value)
(j/get o .-k :fallback-value)
```
source (clj)source (cljs)raw docstring

JSLookupcljs

source

lookupcljs

(lookup obj)

Returns object which implements ILookup and reads keys from obj.

(let [{:keys [a b c]} (j/lookup o)]
 ...)
Returns object which implements ILookup and reads keys from `obj`.

```
(let [{:keys [a b c]} (j/lookup o)]
 ...)
```
sourceraw docstring

objclj/s≠

(obj & keyvals)
cljs

Create JavaSript object from an even number arguments representing interleaved keys and values. Dot-prefixed symbol keys will be renamable.

(obj :a 1 :b 2 .-c 3 .-d 4)
Create JavaSript object from an even number arguments representing
interleaved keys and values. Dot-prefixed symbol keys will be renamable.

```
(obj :a 1 :b 2 .-c 3 .-d 4)
```
source (clj)source (cljs)raw docstring

push!clj/s≠

(push! a v)
cljs

Adds v to end of array a and returns the mutated array.

(j/push! arr 10)
Adds `v` to end of array `a` and returns the mutated array.

```
(j/push! arr 10)
```
source (clj)source (cljs)raw docstring

select-keysclj/s≠

(select-keys obj ks)
cljs

Returns an object containing only those entries in o whose key is in ks.

(j/select-keys o [:a :b :c])
(j/select-keys o [.-a .-b .-c])
Returns an object containing only those entries in `o` whose key is in `ks`.

```
(j/select-keys o [:a :b :c])
(j/select-keys o [.-a .-b .-c])
```
source (clj)source (cljs)raw docstring

unchecked-getclj/s

(unchecked-get obj k)
source (clj)source (cljs)

unchecked-setclj/s≠

clj
(unchecked-set obj & pairs)
cljs
(unchecked-set obj k val)
source (clj)source (cljs)

unshift!clj/s≠

(unshift! a v)
cljs

Adds v to the beginning of array a and returns the mutated array.

(j/unshift! arr 10)
Adds `v` to the beginning of array `a` and returns the mutated array.

```
(j/unshift! arr 10)
```
source (clj)source (cljs)raw docstring

update!clj/s≠

(update! obj k f & args)
cljs

'Updates' a value in a JavaScript object, where k is a key and f is a function that will take the old value and any supplied args and return the new value, which replaces the old value. If the key does not exist, nil is passed as the old value.

(j/update! o :foo + 10)
(j/update! o .-foo + 10)
'Updates' a value in a JavaScript object, where k is a key and
f is a function that will take the old value and any supplied
args and return the new value, which replaces the old value.
If the key does not exist, nil is passed as the old value.

```
(j/update! o :foo + 10)
(j/update! o .-foo + 10)
```
source (clj)source (cljs)raw docstring

update-in!clj/s≠

(update-in! obj ks f & args)
cljs

'Updates' a value in a nested object structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, mutating the nested structure. If any levels do not exist, objects will be created.

(j/update-in! o [:foo :goo] + 10)
(j/update-in! o [.-foo .-goo] + 10)
'Updates' a value in a nested object structure, where ks is a
sequence of keys and f is a function that will take the old value
and any supplied args and return the new value, mutating the
nested structure.  If any levels do not exist, objects will be
created.

```
(j/update-in! o [:foo :goo] + 10)
(j/update-in! o [.-foo .-goo] + 10)
```
source (clj)source (cljs)raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close