CrossClj

0.1.20 docs

SourceDocs



RECENT

    district0x

    Clojars

    Aug 9, 2017


    OWNER
    district0x
    district0x.io

    Readme

    Index of all namespaces


    « Project + dependencies

    district0x Frontend Library

    cljs-time.coerce — cljsDocsSource
    ### Utilites to coerce goog.data DateTime instances to and from
    various other types.
    
    For example, to convert a goog.date DateTime to and from a js number:
    
      => (to-long (date-time 1998 4 25))
      893462400000
    
      => (from-long 893462400000)
      #<19980425T000000>
    cljs-time.core — cljsDocsSource
    ### The core namespace for date-time operations in the cljs-time library.
    
    Create a DateTime instance with date-time (or a local DateTime instance with local-date-time),
    specifying the year, month, day, hour, minute, second, and millisecond:
    
      => (date-time 1986 10 14 4 3 27 456)
      #<DateTime 1986-10-14T04:03:27.456Z>
    
      => (local-date-time 1986 10 14 4 3 27 456)
      #<DateTime 1986-10-14T04:03:27.456>
    
    Less-significant fields can be omitted:
    
      => (date-time 1986 10 14)
      #<DateTime 1986-10-14T00:00:00.000Z>
    
      => (local-date-time 1986 10 14)
      #<DateTime 1986-10-14T00:00:00.000>
    
    Get the current time with (now) and the start of the Unix epoch with (epoch).
    
    Once you have a date-time, use accessors like hour and second to access the
    corresponding fields:
    
      => (hour (date-time 1986 10 14 22))
      22
    
      => (hour (local-date-time 1986 10 14 22))
      22
    
    The functions after? and before? determine the relative position of two
    DateTime instances:
    
      => (after? (date-time 1986 10) (date-time 1986 9))
      true
    
      => (after? (local-date-time 1986 10) (local-date-time 1986 9))
      true
    
    Often you will want to find a date some amount of time from a given date. For
    example, to find the time 1 month and 3 weeks from a given date-time:
    
      => (plus (date-time 1986 10 14) (months 1) (weeks 3))
      #<DateTime 1986-12-05T00:00:00.000Z>
    
      => (plus (local-date-time 1986 10 14) (months 1) (weeks 3))
      #<DateTime 1986-12-05T00:00:00.000Z>
    
    An Interval is used to represent the span of time between two DateTime
    instances. Construct one using interval, then query them using within?,
    overlaps?, and abuts?
    
      => (within? (interval (date-time 1986) (date-time 1990)) (date-time 1987))
      true
    
    To find the amount of time encompased by an interval, use in-seconds and
    in-minutes:
    
      => (in-minutes (interval (date-time 1986 10 2) (date-time 1986 10 14)))
      17280
    
    Note that all functions in this namespace work with Joda objects or ints. If
    you need to print or parse date-times, see cljs-time.format. If you need to
    ceorce date-times to or from other types, see cljs-time.coerce.
    cljs-time.format — cljsDocsSource
    ### Utilities for parsing and unparsing DateTimes as Strings.
    
    Parsing and printing are controlled by formatters. You can either use one
    of the built in ISO 8601 and a single RFC 822 formatters or define your own, e.g.:
    
      (def built-in-formatter (formatters :basic-date-time))
      (def custom-formatter (formatter "yyyyMMdd"))
    
    To see a list of available built-in formatters and an example of a date-time
    printed in their format:
    
      (show-formatters)
    
    Once you have a formatter, parsing and printing are strait-forward:
    
      => (parse custom-formatter "20100311")
      #<DateTime 2010-03-11T00:00:00.000Z>
    
      => (unparse custom-formatter (date-time 2010 10 3))
      "20101003"
    
    By default the parse function always returns a DateTime instance with a UTC
    time zone, and the unparse function always represents a given DateTime
    instance in UTC. A formatter can be modified to different timezones, locales,
    etc with the functions with-zone, with-locale, with-chronology, and
    with-pivot-year.
    cljs.core — cljsDocsSource

    VARS

    - * *1 *2 *3 + - / < <= = == > >=

    A *assert* ->ArrayChunk ->ArrayIter ->ArrayList ->ArrayNode ->ArrayNodeIterator ->ArrayNodeSeq ->Atom accumulating-seq-count aclone add-to-string-hash-cache add-watch aget alength alter-meta! ancestors apply apply-to array array->transient-hash-map array-chunk array-copy array-copy-downward array-extend-kv array-for array-index-of array-index-of-equiv? array-index-of-identical? array-index-of-keyword? array-index-of-nil? array-index-of-symbol? array-iter array-list array-map array-map-extend-kv array-map-index-of array-reduce array-seq array? ArrayChunk ArrayIter ArrayList ArrayNode ArrayNodeIterator ArrayNodeSeq ASeq aset assoc assoc! assoc-in associative? atom Atom

    B ->BitmapIndexedNode ->BlackNode ->Box balance-left balance-left-del balance-right balance-right-del bit-and bit-and-not bit-clear bit-count bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-shift-right-zero-fill bit-test bit-xor bitmap-indexed-node-index BitmapIndexedNode bitpos BlackNode boolean booleans bounded-count Box build-subvec butlast byte bytes

    C *clojurescript-version* ->ChunkBuffer ->ChunkedCons ->ChunkedSeq ->Cons cat char char-escapes char? CHAR_MAP chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest ChunkBuffer chunked-seq chunked-seq? ChunkedCons ChunkedSeq ci-reduce clj->js clone clone-and-set cloneable? coll? comp comparator compare compare-and-set! compare-indexed compare-keywords compare-symbols complement completing concat conj conj! cons Cons constantly contains? count counted? create-array-node-seq create-inode-seq create-node create-ns create-tree-map-seq cycle

    D ->Delay dec dedupe default-dispatch-val Delay delay? demunge demunge-pattern demunge-str DEMUNGE_MAP DEMUNGE_PATTERN deref derive descendants disj disj! dispatch-fn dissoc dissoc! distinct distinct? divide do-assoc doall dominates dorun double double-array doubles drop drop-last drop-while

    E *e ->Eduction ->EmptyList ->ES6EntriesIterator ->ES6Iterator ->ES6IteratorSeq ->ES6SetEntriesIterator edit-and-set eduction Eduction empty empty-ordered-hash empty-unordered-hash empty? EmptyList enable-console-print! ensure-reduced equiv-map equiv-sequential es6-entries-iterator es6-iterator es6-iterator-seq es6-set-entries-iterator ES6EntriesIterator ES6Iterator ES6IteratorSeq ES6SetEntriesIterator even? every-pred every? ex-cause ex-data ex-info ex-message ExceptionInfo extend-object!

    F *flush-on-newline* false? ffirst filter filterv find find-and-cache-best-method find-macros-ns find-ns find-ns-obj find-ns-obj* first first-array-for-longvec fix fixture1 fixture2 flatten flatten1 float floats flush Fn fn->comparator fn? fnext fnil force frequencies

    G -global-hierarchy gensym gensym_counter get get-global-hierarchy get-in get-method get-validator group-by

    H ->HashCollisionNode ->HashMapIter ->HashSetIter hash hash-coll hash-collision-node-find-index hash-combine hash-imap hash-iset hash-keyword hash-map hash-ordered-coll hash-set hash-string hash-string* hash-symbol hash-unordered-coll HashCollisionNode HashMapIter HashSetIter

    I ->IndexedSeq ->IndexedSeqIterator -indexOf IAssociative IAtom IChunk IChunkedNext IChunkedSeq ICloneable ICollection IComparable ICounted identical? identity IDeref IDerefWithTimeout IEditableCollection IEmptyableCollection IEncodeClojure IEncodeJS IEquiv IFn ifn? IHash IIndexed IIterable IKVReduce IList ILookup IMap IMapEntry IMeta imul IMultiFn INamed inc indexed? IndexedSeq IndexedSeqIterator INext INIT inode-kv-reduce instance? int int-array int-rotate-left integer? interleave interpose into into-array ints IPending IPrintWithWriter IRecord IReduce IReset IReversible is_proto_ isa? ISeq ISeqable ISequential ISet ISorted IStack ISwap iter ITER_SYMBOL iterable? iterate ITransientAssociative ITransientCollection ITransientMap ITransientSet ITransientVector IVector IVolatile IWatchable IWithMeta IWriter

    J js->clj js-delete js-invoke js-keys js-mod js-obj js-reserved js-reserved-arr js-reserved? juxt

    K ->KeySeq ->Keyword keep keep-indexed key key->js key-test keys KeySeq Keyword keyword keyword-identical? keyword?

    L *loaded-libs* ->LazySeq ->LazyTransformer ->List -lastIndexOf last lazy-transformer LazySeq LazyTransformer linear-traversal-nth list List list* list? load-file long long-array longs lookup-sentinel

    M *main-cli-fn* ->MetaFn ->MultiFn ->MultiStepper m3-C1 m3-C2 m3-fmix m3-hash-int m3-hash-unencoded-chars m3-mix-H1 m3-mix-K1 m3-seed make-array make-hierarchy map map-indexed map? mapcat mapv mask max max-key memoize merge merge-with meta MetaFn methods min min-key missing-protocol mix-collection-hash mk-bound-fn mod multi-stepper MultiFn MultiStepper munge munge-str

    N *ns* ->Namespace ->NeverEquiv ->NodeIterator ->NodeSeq name namespace Namespace native-satisfies? neg? never-equiv NeverEquiv new-path newline next nfirst nil-iter nil? nnext NodeIterator NodeSeq not not-any? not-empty not-every? not-native not= ns-interns* ns-lookup ns-name NS_CACHE nth nthnext nthrest number?

    O *out* ->ObjMap obj-clone obj-map obj-map->hash-map obj-map-compare-keys object-array object? ObjMap odd?

    P *print-dup* *print-err-fn* *print-fn* *print-length* *print-level* *print-meta* *print-newline* *print-readably* ->PersistentArrayMap ->PersistentArrayMapIterator ->PersistentArrayMapSeq ->PersistentHashMap ->PersistentHashSet ->PersistentQueue ->PersistentQueueIter ->PersistentQueueSeq ->PersistentTreeMap ->PersistentTreeMapSeq ->PersistentTreeSet ->PersistentVector pack-array-node parents partial partition partition-all partition-by peek persistent! persistent-array-map-seq PersistentArrayMap PersistentArrayMapIterator PersistentArrayMapSeq PersistentHashMap PersistentHashSet PersistentQueue PersistentQueueIter PersistentQueueSeq PersistentTreeMap PersistentTreeMapSeq PersistentTreeSet PersistentVector pop pop! pop-tail pos? pr pr-opts pr-sb-with-opts pr-seq-writer pr-sequential-writer pr-str pr-str* pr-str-with-opts pr-with-opts pr-writer pr-writer-ex-info pr-writer-impl prefer-method prefers prefers* preserving-reduced prim-seq print print-map print-meta? print-str println println-str prn prn-str prn-str-with-opts push-tail pv-aget pv-aset pv-clone-node pv-fresh-node

    Q quot quote-string

    R ->Range ->RangedIterator ->RangeIterator ->RecordIter ->RedNode ->Reduced ->RSeq rand rand-int rand-nth random-sample random-uuid range Range ranged-iterator RangedIterator RangeIterator re-find re-matches re-pattern re-seq realized? record? RecordIter RedNode reduce reduce-kv reduceable? Reduced reduced reduced? reductions regexp? rem remove remove-all-methods remove-method remove-pair remove-watch repeat repeatedly replace replicate reset! reset-cache reset-meta! rest reverse reversible? RSeq rseq rsubseq run!

    S ->SeqIter ->Stepper ->StringBufferWriter ->StringIter ->Subvec ->Symbol scan-array second select-keys seq seq-iter seq-reduce seq? seqable? SeqIter sequence sequential? set set-from-indexed-seq set-print-err-fn! set-print-fn! set-validator! set? short shorts shuffle some some-fn some? sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? split-at split-with spread START stepper Stepper str string-hash-cache string-hash-cache-count string-iter string-print string? StringBufferWriter StringIter subs subseq Subvec subvec swap! swap-global-hierarchy! Symbol symbol symbol-identical? symbol? system-time

    T ->TaggedLiteral ->TransientArrayMap ->TransientHashMap ->TransientHashSet ->TransientVector tagged-literal tagged-literal? TaggedLiteral tail-off take take-last take-nth take-while test throw-no-method-error to-array to-array-2d trampoline transduce transient TransientArrayMap TransientHashMap TransientHashSet TransientVector tree-map-add tree-map-append tree-map-kv-reduce tree-map-remove tree-map-replace tree-map-seq-push tree-seq true? truth_ tv-editable-root tv-editable-tail tv-ensure-editable tv-pop-tail tv-push-tail type type->str

    U *unchecked-if* ->UUID unchecked-add unchecked-add-int unchecked-array-for unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-editable-array-for unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int undefined? underive unreduced unsigned-bit-shift-right update update-in uuid UUID

    V ->ValSeq ->Var ->VectorNode ->Volatile val vals ValSeq Var var? vary-meta vec vector vector-index-out-of-bounds vector? VectorNode Volatile volatile! volatile? vreset!

    W with-meta write-all

    Z zero? zipmap

    cljs.test — cljsDocsSource
    A unit testing framework.
    
    ASSERTIONS
    
    The core of the library is the "is" macro, which lets you make
    assertions of any arbitrary expression:
    
    (is (= 4 (+ 2 2)))
    (is (instance? Integer 256))
    (is (.startsWith "abcde" "ab"))
    
    You can type an "is" expression directly at the REPL, which will
    print a message if it fails.
    
        user> (is (= 5 (+ 2 2)))
    
        FAIL in  (:1)
        expected: (= 5 (+ 2 2))
          actual: (not (= 5 4))
        false
    
    The "expected:" line shows you the original expression, and the
    "actual:" shows you what actually happened.  In this case, it
    shows that (+ 2 2) returned 4, which is not = to 5.  Finally, the
    "false" on the last line is the value returned from the
    expression.  The "is" macro always returns the result of the
    inner expression.
    
    There are two special assertions for testing exceptions.  The
    "(is (thrown? c ...))" form tests if an exception of class c is
    thrown:
    
    (is (thrown? ArithmeticException (/ 1 0))) 
    
    "(is (thrown-with-msg? c re ...))" does the same thing and also
    tests that the message on the exception matches the regular
    expression re:
    
    (is (thrown-with-msg? ArithmeticException #"Divide by zero"
                          (/ 1 0)))
    
    DOCUMENTING TESTS
    
    "is" takes an optional second argument, a string describing the
    assertion.  This message will be included in the error report.
    
    (is (= 5 (+ 2 2)) "Crazy arithmetic")
    
    In addition, you can document groups of assertions with the
    "testing" macro, which takes a string followed by any number of
    assertions.  The string will be included in failure reports.
    Calls to "testing" may be nested, and all of the strings will be
    joined together with spaces in the final report, in a style
    similar to RSpec <http://rspec.info/>
    
    (testing "Arithmetic"
      (testing "with positive integers"
        (is (= 4 (+ 2 2)))
        (is (= 7 (+ 3 4))))
      (testing "with negative integers"
        (is (= -4 (+ -2 -2)))
        (is (= -1 (+ 3 -4)))))
    
    Note that, unlike RSpec, the "testing" macro may only be used
    INSIDE a "deftest" form (see below).
    
    
    DEFINING TESTS
    
    (deftest addition
      (is (= 4 (+ 2 2)))
      (is (= 7 (+ 3 4))))
    
    (deftest subtraction
      (is (= 1 (- 4 3)))
      (is (= 3 (- 7 4))))
    
    This creates functions named "addition" and "subtraction", which
    can be called like any other function.  Therefore, tests can be
    grouped and composed, in a style similar to the test framework in
    Peter Seibel's "Practical Common Lisp"
    <http://www.gigamonkeys.com/book/practical-building-a-unit-test-framework.html>
    
    (deftest arithmetic
      (addition)
      (subtraction))
    
    The names of the nested tests will be joined in a list, like
    "(arithmetic addition)", in failure reports.  You can use nested
    tests to set up a context shared by several tests.
    
    DEFINING ASYNC TESTS
    
    (deftest addition
      (async done
        (is (= 4 (+ 2 2)))
        (is (= 7 (+ 3 4)))
        (done)))
    
    Async tests are constructed with the async macro. The first argument to
    the macro is the test completion callback. The body of the async macro may
    be any series of expressions. The completion callback must be invoked when
    all assertions have run. There is no support for asynchronous coordination -
    core.async is recommended for this. Note the body of the async test must be
    truly asynchronous to avoid stack overflow.
    
    RUNNING TESTS
    
    Run tests with the function "(run-tests namespaces...)":
    
    (run-tests 'your.namespace 'some.other.namespace)
    
    If you don't specify any namespaces, the current namespace is
    used.  To run all tests in all namespaces, use "(run-all-tests)".
    
    By default, these functions will search for all tests defined in
    a namespace and run them in an undefined order.  However, if you
    are composing tests, as in the "arithmetic" example above, you
    probably do not want the "addition" and "subtraction" tests run
    separately.  In that case, you must define a special function
    named "test-ns-hook" that runs your tests in the correct order:
    
    (defn test-ns-hook []
      (arithmetic))
    
    "run-tests" also optionally takes a testing enviroment. A default
    one is supplied for you by invoking "empty-env".  The test
    environment contains everything needed to run tests including the
    report results map. Fixtures must be present here if you want them
    to run. Note that code that relies on "test-ns" will
    automatically be supplied the appropriate defined fixtures.  For
    example, this is done for you if you use "run-tests".
    
    Note: test-ns-hook prevents execution of fixtures (see below).
    
    
    OMITTING TESTS FROM PRODUCTION CODE
    
    You can set the ClojureScript compiler build option
    ":load-tests" to false when loading or compiling code in
    production.  This will prevent any tests from being created by
    or "deftest".
    
    
    FIXTURES
    
    Fixtures allow you to run code before and after tests, to set up
    the context in which tests should be run.
    
    A fixture is a map of one or two functions that run code before and
    after tests.  It looks like this:
    
    {:before (fn []
               Perform setup, establish bindings, whatever.
               )
     :after (fn []
              Tear-down / clean-up code here.
              )}
    
    Both are optional and can be left out.
    
    Fixtures are attached to namespaces in one of two ways.  "each"
    fixtures are run repeatedly, once for each test function created
    with "deftest".  "each" fixtures are useful for
    establishing a consistent before/after state for each test, like
    clearing out database tables.
    
    "each" fixtures can be attached to the current namespace like this:
    (use-fixtures :each fixture1 fixture2 ...)
    The fixture1, fixture2 are just maps like the example above.
    They can also be passed directly, like this:
    (use-fixtures :each
      {:before (fn [] setup...), :after (fn [] cleanup...)})
    
    The other kind of fixture, a "once" fixture, is only run once,
    around ALL the tests in the namespace.  "once" fixtures are useful
    for tasks that only need to be performed once, like establishing
    database connections, or for time-consuming tasks.
    
    Attach "once" fixtures to the current namespace like this:
    (use-fixtures :once fixture1 fixture2 ...)
    
    Note: Fixtures and test-ns-hook are mutually incompatible.  If you
    are using test-ns-hook, fixture functions will *never* be run.
    
    
    WRAPPING FIXTURES
    
    Instead of a map, a fixture can be specified like this:
    
    (defn my-fixture [f]
       Perform setup, establish bindings, whatever.
      (f)  Then call the function we were passed.
       Tear-down / clean-up code here.
     )
    
    This style is incompatible with async tests. If an async test is
    encountered, testing will be aborted. It can't be mixed with
    fixtures specified as maps.
    
    
    EXTENDING TEST-IS (ADVANCED)
    
    You can extend the behavior of the "is" macro by defining new
    methods for the "assert-expr" multimethod.  These methods are
    called during expansion of the "is" macro, so they should return
    quoted forms to be evaluated.
    
    You can plug in your own test-reporting framework by specifying a
    :reporter key in the test environment. It is normally set to
    :cljs.test/default. Set this to the desired key and supply custom
    implementations of the "report" multimethod.
    
    The 'event' argument is a map.  It will always have a :type key,
    whose value will be a keyword signaling the type of event being
    reported.  Standard events with :type value of :pass, :fail, and
    :error are called when an assertion passes, fails, and throws an
    exception, respectively.  In that case, the event will also have
    the following keys:
    
      :expected   The form that was expected to be true
      :actual     A form representing what actually occurred
      :message    The string message given as an argument to 'is'
    
    The "testing" strings will be a list in the :testing-contexts
    property of the test environment, and the vars being tested will be
    a list in the :testing-vars property of the test environment.
    
    For additional event types, see the examples in the code.
    clojure.walk — cljsDocsSource
    This file defines a generic tree walker for Clojure data
    structures.  It takes any data structure (list, vector, map, set,
    seq), calls a function on every element, and uses the return value
    of the function in place of the original.  This makes it fairly
    easy to write recursive search-and-replace functions, as shown in
    the examples.
    
    Note: "walk" supports all Clojure data structures EXCEPT maps
    created with sorted-map-by.  There is no (obvious) way to retrieve
    the sorting function.
    devtools.munging — cljsDocsSource
    This namespace implements various heuristics to map Javascript names back to corresponding ClojureScript names.
    The functionality here heavily depends on observed ClojureScript compiler and runtime behaviour (fragile!).
    Answers given by functions in this namespace cannot be perfect because generated Javascript naming schemes produced by
    ClojureScript compiler were not designed with easy reversibility in mind. We recommend this functionality to be used for
    presentation in the UI only. The goal here is to provide user with more familiar view of runtime state of her app
    in most common cases (on best effort basis).
    
    Our main weapons in this uneven fight are:
      1. munged function names as they appear in Javascript (generated by ClojureScript)
      2. we can also analyze function sources accessible via .toString
      3. special cljs$core$IFn$_invoke protocol props generated for multi-arity functions
    
    We can also cheat and look at runtime state of browser environment to determine some answers about namespaces.
    
    If you discovered breakage or a new case which should be covered by this code, please open an issue:
      https://github.com/binaryage/cljs-devtools/issues
    re-frame.registrarDocsSource
    In many places, re-frame asks you to associate an id (keyword)
    with a handler (function).  This namespace contains the
    central registry of such associations.
    The README below is fetched from the published project artifact. Some relative links may be broken.

    d0xINFRA Frontend Library

    district0x is network of decentralized markets and communities. Create, operate, and govern. Powered by Ethereum, Aragon, and IPFS.

    This library contains frontend logic shared by all districts. It’s in very early stages, will be subject to frequent changes.