Members
(static, constant) ANIMATION
    get string "animation" with the vendor prefix.
    Example
import {ANIMATION} from "@daybrush/utils";
console.log(ANIMATION); // "animation", "-ms-animation", "-webkit-animation"
        
            
(static, constant) FILTER
    get string "filter" with the vendor prefix.
    Example
import {FILTER} from "@daybrush/utils";
console.log(FILTER); // "filter", "-ms-filter", "-webkit-filter"
        
            
(static, constant) KEYFRAMES
    get string "keyframes" with the vendor prefix.
    Example
import {KEYFRAMES} from "@daybrush/utils";
console.log(KEYFRAMES); // "keyframes", "-ms-keyframes", "-webkit-keyframes"
        
            
(static, constant) TRANSFORM
    get string "transfrom" with the vendor prefix.
    Example
import {TRANSFORM} from "@daybrush/utils";
console.log(TRANSFORM); // "transform", "-ms-transform", "-webkit-transform"
        
    
    
        Methods
(static) cancelAnimationFrame(handle) → {void}
    window.cancelAnimationFrame() method with cross browser.
    
| Name | Type | Description | 
|---|---|---|
handle | 
            
            number | the id obtained through requestAnimationFrame method | 
Example
import { requestAnimationFrame, cancelAnimationFrame } from "@daybrush/utils";
const id = requestAnimationFrame((timestamp) => {
  console.log(timestamp);
});
cancelAnimationFrame(id);
Returns:
- Type
 - void
 
(static) find<T>(arr, callback, defalutValueopt) → {T | undefined}
    Returns the value of the first element in the array that satisfies the provided testing function.
    
| Name | Type | Description | 
|---|---|---|
arr | 
            
            T[] | The array `find` was called upon. | 
callback | 
            
            (element: T, index: number, arr: T[]) => any | A function to execute on each value in the array, | 
defalutValue? | 
            
            T | Returns defalutValue if not found by the function. | 
Example
import { find } from "@daybrush/utils";
find([{a: 1}, {a: 2}, {a: 3}, {a: 4}], ({ a }) => a === 2); // {a: 2}
Returns:
- Type
 - T | undefined
 
(static) findIndex<T>(arr, callback, defaultIndexopt) → {number}
    Returns the index of the first element in the array that satisfies the provided testing function.
    
| Name | Type | Default | Description | 
|---|---|---|---|
arr | 
            
            T[] | The array `findIndex` was called upon. | |
callback | 
            
            (element: T, index: number, arr: T[]) => any | A function to execute on each value in the array until the function returns true, indicating that the satisfying element was found. | |
defaultIndex? | 
            
            number | 
                
                    -1
                
                 | 
            
            Returns defaultIndex if not found by the function. | 
Example
import { findIndex } from "@daybrush/utils";
findIndex([{a: 1}, {a: 2}, {a: 3}, {a: 4}], ({ a }) => a === 2); // 1
Returns:
- Type
 - number
 
(static) findLast<T>(arr, callback, defalutValueopt) → {T | undefined}
    Returns the value of the reverse direction element in the array that satisfies the provided testing function.
    
| Name | Type | Description | 
|---|---|---|
arr | 
            
            T[] | The array `findLast` was called upon. | 
callback | 
            
            (element: T, index: number, arr: T[]) => any | A function to execute on each value in the array, | 
defalutValue? | 
            
            T | Returns defalutValue if not found by the function. | 
Example
import { find } from "@daybrush/utils";
find([{a: 1}, {a: 2}, {a: 3}, {a: 4}], ({ a }) => a === 2); // {a: 2}
Returns:
- Type
 - T | undefined
 
(static) findLastIndex<T>(arr, callback, defaultIndexopt) → {number}
    Returns the reverse direction index of the first element in the array that satisfies the provided testing function.
    
| Name | Type | Default | Description | 
|---|---|---|---|
arr | 
            
            T[] | The array `findLastIndex` was called upon. | |
callback | 
            
            (element: T, index: number, arr: T[]) => any | A function to execute on each value in the array until the function returns true, indicating that the satisfying element was found. | |
defaultIndex? | 
            
            number | 
                
                    -1
                
                 | 
            
            Returns defaultIndex if not found by the function. | 
Example
import { findLastIndex } from "@daybrush/utils";
findLastIndex([{a: 1}, {a: 2}, {a: 3}, {a: 4}], ({ a }) => a === 2); // 1
Returns:
- Type
 - number
 
(static) getCrossBrowserProperty(property) → {string}
    Get a CSS property with a vendor prefix that supports cross browser.
    
| Name | Type | Description | 
|---|---|---|
property | 
            
            string | A CSS property | 
Example
import {getCrossBrowserProperty} from "@daybrush/utils";
console.log(getCrossBrowserProperty("transform")); // "transform", "-ms-transform", "-webkit-transform"
console.log(getCrossBrowserProperty("filter")); // "filter", "-webkit-filter"
Returns:
    CSS property with cross-browser vendor prefix
- Type
 - string
 
(static) now() → {number}
    Date.now() method
    Example
import {now} from "@daybrush/utils";
console.log(now()); // 12121324241(milliseconds)
Returns:
    milliseconds
- Type
 - number
 
(static) requestAnimationFrame(callback) → {number}
    window.requestAnimationFrame() method with cross browser.
    
| Name | Type | Description | 
|---|---|---|
callback | 
            
            FrameRequestCallback | The function to call when it's time to update your animation for the next repaint. | 
Example
import {requestAnimationFrame} from "@daybrush/utils";
requestAnimationFrame((timestamp) => {
  console.log(timestamp);
});
Returns:
    id
- Type
 - number