-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
11 changed files
with
100 additions
and
16 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
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,6 +1,6 @@ | ||
{ | ||
"name": "deverything", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Everything you need for Dev", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
|
@@ -54,5 +54,6 @@ | |
"ts-node": "^10.9.2", | ||
"tsup": "^6.7.0", | ||
"typescript": "^4.9.5" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a" | ||
} |
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,12 @@ | ||
import { PlainObject } from "../types/Object"; | ||
|
||
/** | ||
* | ||
* @example formatCookies({}) => "" | ||
* @example formatCookies({ session: "123", _ga: 123 }) => "session=123; _ga=123" | ||
*/ | ||
export const formatCookies = (object: PlainObject): string => { | ||
return Object.entries(object) | ||
.map(([key, value]) => `${key}=${value}`) | ||
.join("; "); | ||
}; |
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,7 @@ | ||
/** | ||
* @returns a string with only alphanumeric characters | ||
* @example filterAlphanumeric("!abc()") // returns "abc" | ||
*/ | ||
export const filterAlphanumeric = (string: string) => { | ||
return string.replace(/[^a-zA-Z0-9]/g, ""); | ||
}; |
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
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,2 +1,7 @@ | ||
export const isFunction = (arg: any): arg is Function => | ||
Object.prototype.toString.call(arg) === "[object Function]"; | ||
/** | ||
* @returns true if the argument can be called like a function -> fn() or await fn() | ||
*/ | ||
export const isFunction = (arg: any): arg is Function => { | ||
const type = Object.prototype.toString.call(arg); | ||
return type === "[object Function]" || type === "[object AsyncFunction]"; | ||
}; |