can-util
Common JavaScript utilities for the rest of CanJS.
Object
can-util/js
- assign - A simplified version of Object.assign, which only accepts a single source argument.
- base-url - Get and/or set the "base" (containing path) of the document.
- cid - Deprecated. Use can-cid instead.
- deep-assign - Assign properties from a source object to a target object, deeply copying properties that are objects or arrays.
- defaults - Mimics _.defaults. Assigns first level properties in sources from left to right if they are not already defined.
- deparam - Takes a string of name value pairs and returns a Object literal that represents those params.
- dev - Utilities for logging development-mode messages. Use this module for anything that should be shown to the user during development but isn't needed in production. In production these functions become noops.
- diff - Returns the difference between two ArrayLike objects (that have nonnegative integer keys and the
length
property) as an array of patch objects. - diff-object - Find the differences between two objects, based on properties and values.
- each - Loop over each element in an Array-Like data structure.
- get - Returns the value at the specified property path of an object.
- global - Returns the global that an environment provides.
- import - Imports a module.
- is-array-like - Determines if an object is "array like", meaning it can be looped over. Any object with a
.length
property is array like. - is-browser-window - Returns
true
if the code is running within a Browser window. Use this function if you need special code paths for when running in a Browser window, a Web Worker, or another environment (such as Node.js). - is-empty-object - Used to determine if an object is an empty object (an object with no enumerable properties) such as
{}
. - [can-util/js/is-function/is-function] - Used to determine if a value is a function.
- is-node - Determines if your code is running in Node.js.
- is-plain-object - Attempts to determine if an object is a plain object like those you would create using the curly braces syntax:
{}
. - is-promise - Determines if object is a Promise.
- is-promise-like - Determines if an object is "Then-able".
- is-string - Determines if the provided argument is a string.
- is-web-worker - Determines if the code is running with a Web Worker.
- join-uris - Provides a convenient way to join together URIs handling relative paths.
- log - Utilities for logging to the console.
- make-array - Takes any array-like object (can-list, NodeList, etc.) and converts it to a JavaScript array.
- make-promise - Will make isPromiseLike object into Promise.
- omit - Omit properties from an object.
- param - Takes an Object of name value pairs and returns a String with the parameters encoded.
- set-immediate - Polyfill for setImmediate() if it doesn't exist in the global context.
- string - String utilities used by CanJS libraries.
- string-to-any - Turns a string representation of a primitive type back into the associated primitive.
- types - Deprecated. Use can-types instead.
can-util/dom
- [can-util/dom/ajax/ajax] - Used to make an asynchronous HTTP (AJAX) request similar to http://api.jquery.com/jQuery.ajax/jQuery.ajax.
- attr - A module that makes it easy to access attributes and properties of elements.
- child-nodes - Get all of the childNodes of a given node.
- class-name - Allows querying and manipulation of classes on HTML elements.
- data - Allows associating data as a key/value pair for a particular DOM node.
- dispatch - Dispatch an event on an element.
- [can-util/dom/document/document] - Optionally sets, and returns, the document object for the context.
- events - Allows you to listen to a domEvent and special domEvents as well as dispatch domEvents.
- frag - Convert a String, HTMLElement, documentFragment, or contentArray into a documentFragment.
- mutate - Mutate an element by appending, inserting, and removing DOM nodes. Use this so that on the server "inserted" will be fired.