-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
610 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export const collectionItems = [ | ||
{ text: 'cloneDeep', link: '/collection/clone-deep' }, | ||
{ text: 'cloneDeepWith', link: '/collection/clone-deep-with' }, | ||
{ text: 'merge', link: '/collection/merge' }, | ||
{ text: 'mergeWith', link: '/collection/merge-with' }, | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const fileItems = [ | ||
{ text: 'toDataURL', link: '/file/to-data-url' }, | ||
{ text: 'toText', link: '/file/to-text' }, | ||
{ text: 'toDataURL', link: '/file/to-data-url' }, | ||
{ text: 'toArrayBuffer', link: '/file/to-array-buffer' }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const utilItems = [ | ||
{ text: 'classes', link: '/util/classes' }, | ||
{ text: 'createNamespaceFn', link: '/util/create-namespace-fn' }, | ||
{ text: 'raf', link: '/util/raf' }, | ||
{ text: 'doubleRaf', link: '/util/double-raf' }, | ||
{ text: 'requestAnimationFrame', link: '/util/request-animation-frame' }, | ||
{ text: 'cancelAnimationFrame', link: '/util/cancel-animation-frame' }, | ||
{ text: 'inViewport', link: '/util/in-viewport' }, | ||
{ text: 'preventDefault', link: '/util/prevent-default' }, | ||
{ text: 'getStyle', link: '/util/get-style' }, | ||
{ text: 'getRect', link: '/util/get-rect' }, | ||
{ text: 'getScrollTop', link: '/util/get-scroll-top' }, | ||
{ text: 'getScrollLeft', link: '/util/get-scroll-left' }, | ||
{ text: 'getParentScroller', link: '/util/get-parent-scroller' }, | ||
{ text: 'getAllParentScroller', link: '/util/get-all-parent-scroller' }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# cloneDeepWith | ||
|
||
Create a deep clone of a value, applying a custom function for cloning on each value. The function will process objects with various types. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isNumber, cloneDeepWith } from 'rattail' | ||
|
||
const original = { a: 1, b: { c: 2 } } | ||
const value = cloneDeepWith(original, (val) => { | ||
if (isNumber(val)) { | ||
return val * 2 | ||
} | ||
}) | ||
// value is { a: 2, b: { c: 4 } } | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :-------------------: | -------: | | ||
| `value` | `any` | | | ||
| `fn` | `(value: any) => any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :---: | | ||
| `any` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# cloneDeep | ||
|
||
Create a deep clone of a value. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { cloneDeep } from 'rattail' | ||
|
||
const original = { a: 1, b: { c: 2 } } | ||
const value = cloneDeep(original) | ||
// value is { a: 1, b: { c: 2 } } | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :---: | | ||
| `any` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isArrayBuffer | ||
|
||
Determine whether the input value is a `ArrayBuffer`. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isArrayBuffer } from 'rattail' | ||
|
||
isArrayBuffer(new ArrayBuffer(8)) // return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isDataView | ||
|
||
Determine whether the input value is a `DataView`. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isDataView } from 'rattail' | ||
|
||
isDataView(new DataView(new ArrayBuffer(1))) // return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isTypedArray | ||
|
||
Determine whether the input value is a `TypedArray`. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isTypedArray } from 'rattail' | ||
|
||
isTypedArray(new Int8Array(8)) // return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isWeakMap | ||
|
||
Determine whether the input value is a `WeakMap`. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isWeakMap } from 'rattail' | ||
|
||
isWeakMap(new WeakMap()) // return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isWeakSet | ||
|
||
Determine whether the input value is a `WeakSet`. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { WeakSet } from 'rattail' | ||
|
||
isWeakMap(new WeakSet()) // return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# classes | ||
|
||
Generates a list of class names based on a given condition or directly returns class names. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { classes } from 'rattail' | ||
|
||
classes('a', [true, 'b', 'c']) | ||
// return ['a', 'b'] | ||
classes('a', [false, 'b', 'c']) | ||
// return ['a', 'c'] | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| --------- | ----------------- | -------- | | ||
| `...args` | `string \| Array` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| ------- | | ||
| `any[]` | |
Oops, something went wrong.