Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Schascha committed Feb 2, 2024
1 parent 5abb4a4 commit 10ff9e9
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 110 deletions.
58 changes: 0 additions & 58 deletions src/array.d.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,10 @@
/**
* Finds a value in array recursively.
* @param {any[]} array The array to query.
* @param {*} value The search element.
* @return {boolean} Returns `true` if `value` is in `array`, else `false`.
*/
export function has(array: any[], value: any): boolean;
/**
* Checks if value or array is empty.
* @param {*} value The value to inspect
* @return {boolean} Returns `true` if `value` is empty, else `false`.
*/
export function isEmpty(value: any): boolean;
/**
* Returns last element from array.
* @param {any[]} array The array The array to query.
* @return {*} Returns the last element of `array`.
*/
export function last(array: any[]): any;
/**
* Returns next element from array.
* @param {number} index
* @param {any[]} array The array to query.
* @param {boolean} [loop=true] Disable infinite array loop.
* @returns {*} Return the previous element of `array`.
*/
export function next(index: number, array: any[], loop?: boolean): any;
/**
* Returns previous element from array.
* @param {number} index
* @param {any[]} array The array to query.
* @param {boolean} [loop=true] Disable infinite array loop.
* @returns {*} Returns the previous element of `array`.
*/
export function prev(index: number, array: any[], loop?: boolean): any;
/**
* Prints a value or an array of values.
* @param {*} value The value to print
* @param {*} [separator=', '] The join separator
* @returns {*} Returns value or joined array of `value`
*/
export function print(value: any, separator?: any): any;
/**
* Pushs a value or an array of values recursively.
* @param {any[]} array The array to query.
* @param {*} value The value to be added.
* @param {boolean} [unique=true] Unique push of strings or numbers to `array`.
* @returns {*} Returns the size of `array` or undefined.
*/
export function push(array: any[], value: any, unique?: boolean): any;
/**
* Returns random element from array.
* @param {any[]} array The array to query.
* @return {*} Returns a random element of `array`.
*/
export function random(array: any[]): any;
/**
* Randomize array.
* @param {any[]} array The array to be shuffled through.
* @returns {*} Returns the shuffled array.
*/
export function shuffle(array: any[]): any;
/**
* Returns value as an array if it's not one.
* @param {*} args The value to inspect.
* @returns {*} Returns the value as an array.
*/
export function toArray(...args: any): any;
5 changes: 0 additions & 5 deletions src/classnames.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
/**
* Conditional class name helper.
* @param {*} args Input of class names.
* @return {string} Returns `args` as string.
*/
export function classnames(...args: any): string;
21 changes: 0 additions & 21 deletions src/cookie.d.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
/**
* Get cookie by name.
* @param {string} name The name of the cookie.
* @return {boolean|string} Returns value of cookie, else false.
*/
export function getCookie(name: string): boolean | string;
/**
* Set cookie.
* @param {string} name The name of the cookie.
* @param {string} value The value of the cookie.
* @param {number} [days=1] The expiration date.
* @return {*}
*/
export function setCookie(name: string, value: string, days?: number): any;
/**
* Remove cookie.
* @param {string} name The name of the cookie.
* @return {*}
*/
export function removeCookie(name: string): any;
/**
* Clear all cookies.
* @return {*}
*/
export function clearCookies(): any;
4 changes: 0 additions & 4 deletions src/copy.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/**
* Copy text to the clipboard
* @param {string} text
*/
export declare function copy(text: any): void;
2 changes: 1 addition & 1 deletion src/copy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copy text to the clipboard
* @param {*} text
* @param {*} text - The text to copy
*/
export function copy(text) {
if (navigator && navigator.clipboard) {
Expand Down
6 changes: 6 additions & 0 deletions src/date.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export declare function addDays(date: Date, days: number): Date;
export declare function addMonths(date: Date, months: number): Date;
export declare function addYears(date: Date, years: number): Date;
export declare function diffInDays(date1: Date, date2: Date): number;
export declare function daysInMonth(date: Date): number;
export declare function formatDate(date: Date, format?: string): string;
21 changes: 11 additions & 10 deletions src/date.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Add days to a date
* @param {Date} date
* @param {number} days
* @param {Date} date - The date to add days to
* @param {number} days - The number of days to add
* @returns Date
*/
export function addDays(date, days) {
Expand All @@ -12,8 +12,8 @@ export function addDays(date, days) {

/**
* Add months to a date
* @param {Date} date
* @param {number} months
* @param {Date} date - The date to add months to
* @param {number} months - The number of months to add
* @returns Date
*/
export function addMonths(date, months) {
Expand All @@ -24,8 +24,8 @@ export function addMonths(date, months) {

/**
* Add years to a date
* @param {Date} date
* @param {number} years
* @param {Date} date - The date to add years to
* @param {number} years - The number of years to add
* @returns Date
*/
export function addYears(date, years) {
Expand All @@ -36,8 +36,8 @@ export function addYears(date, years) {

/**
* Get the difference in days between two dates
* @param {Date} date1
* @param {Date} date2
* @param {Date} date1 - The first date
* @param {Date} date2 - The second date
* @returns number
*/
export function diffInDays(date1, date2) {
Expand All @@ -46,7 +46,7 @@ export function diffInDays(date1, date2) {

/**
* Get the number of days in a month
* @param {Date} date
* @param {Date} date - The date to get the number of days in the month for
* @returns number
*/
export function daysInMonth(date) {
Expand All @@ -55,7 +55,8 @@ export function daysInMonth(date) {

/**
* Format a date as YYYY-MM-DD or a custom format
* @param {Date} date
* @param {Date} date - The date to format
* @param {string} format - The format to use, defaults to YYYY-MM-DD
* @returns string
*/
export function formatDate(date, format = 'YYYY-MM-DD') {
Expand Down
2 changes: 1 addition & 1 deletion src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function filter(obj, filters) {

/**
* Group array items by key.
* @param {Object[]} array An array with objects to query.
* @param {Object[]} array An array with objects to query.
* @param {String} key The key to group the array items.
* @return {Object} Returns a object with grouped arrays by the given key.
*/
Expand Down
5 changes: 0 additions & 5 deletions src/type.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
/**
* Type-checking with Object.prototype.toString() method.
* @param {*} value The value to inspect.
* @returns {string} Returns type as lowercase string.
*/
export function typeOf(value: any): string;
5 changes: 0 additions & 5 deletions src/visible.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
/**
* Returns if the DOM element is visible on the users viewport.
* @param {Element} el The DOM element to be inspected.
* @return {*} Return `true` if element is visible, else `false` or ``undefined`.
*/
export function isVisible(el: Element): any;

0 comments on commit 10ff9e9

Please sign in to comment.