From 66c491f4e87c9cce6c320f54f92ee6604c7972f7 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 16 Jun 2022 19:14:41 +0200 Subject: [PATCH 01/24] Update FUNDING.yml --- .github/FUNDING.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f66c1f9..5d56a6a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,7 +1,7 @@ # These are supported funding model platforms -github: [Ali-Eldeba, Omar khaled] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -# patreon: alieldeba # Replace with a single Patreon username +github: [Ali-Eldeba, OmarWebDev] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: alieldeba # Replace with a single Patreon username # open_collective: # Replace with a single Open Collective username # ko_fi: # Replace with a single Ko-fi username # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel From 08df79d865823327b7ff88118ee5585408310db3 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 16 Jun 2022 19:37:38 +0200 Subject: [PATCH 02/24] Update FUNDING.yml --- .github/FUNDING.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 5d56a6a..f1381c8 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: [Ali-Eldeba, OmarWebDev] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: Ali-Eldeba # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: alieldeba # Replace with a single Patreon username # open_collective: # Replace with a single Open Collective username # ko_fi: # Replace with a single Ko-fi username @@ -10,4 +10,4 @@ patreon: alieldeba # Replace with a single Patreon username # issuehunt: # Replace with a single IssueHunt username # otechie: # Replace with a single Otechie username # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry - custom: [https://www.buymeacoffee.com/alieldeba] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +# custom: [https://www.buymeacoffee.com/alieldeba] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 4a036c65509f34cb00477b80058f924b62c7a9f0 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 16 Jun 2022 19:38:40 +0200 Subject: [PATCH 03/24] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f1381c8..4227249 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: Ali-Eldeba # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +# github: Ali-Eldeba # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: alieldeba # Replace with a single Patreon username # open_collective: # Replace with a single Open Collective username # ko_fi: # Replace with a single Ko-fi username From 6590e0f5f359a8dce0f84a359b34ec511abe7922 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 17 Jun 2022 03:56:47 +0200 Subject: [PATCH 04/24] Update README.md --- README.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/README.md b/README.md index f6e787f..e754953 100644 --- a/README.md +++ b/README.md @@ -62,21 +62,6 @@ - You Can Visit Functionalty.js Site From Here - Or This is A Quick Start From Here -#

Here Is What We Are Working On 🤞

- -1. Adding Logo -2. ✔️ Converting Library Into TypeScript -3. ✔️ Making File Supported By All Of Search Engines -4. ✔️ Making File Compressed -5. ✔️ Making File Light Weight -6. ✔️ Testing The Library -7. ✔️ Handling Function Errors -8. Making A Documentation Website -9. Adding Dark And White Theme In Website -10. ✔️ Adding New Functions -11. ✔️ Making npm Package For Installation -12. ✔️ Making a CDN Importing - #

Feel Free To Contribute To This Repositry 🤝

## To Get Started Contributing ☕ From b551ddbeba15a212534789b3a338a6856359dfb6 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 17 Jun 2022 16:23:46 +0200 Subject: [PATCH 05/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e754953..b3018ed 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

+

#

Functionality.js (beta) 🔥

From 0b921aeef5385915d72a49496768b7bd66c119b9 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 17 Jun 2022 22:14:29 +0200 Subject: [PATCH 06/24] Delete robots.txt --- robots.txt | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 robots.txt diff --git a/robots.txt b/robots.txt deleted file mode 100644 index 9e60f97..0000000 --- a/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: From d4fe650e47e760f6759872f82ebad5cde586f530 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Sat, 18 Jun 2022 20:30:36 +0200 Subject: [PATCH 07/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3018ed..9391650 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

-#

Functionality.js (beta) 🔥

+#

Functionality.js

From af2e5df99b99c036c89460ab7856c434ae808eb6 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Mon, 20 Jun 2022 01:09:57 +0200 Subject: [PATCH 08/24] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 4227249..a4cfe69 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ # github: Ali-Eldeba # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: alieldeba # Replace with a single Patreon username -# open_collective: # Replace with a single Open Collective username +open_collective: alieldeba # Replace with a single Open Collective username # ko_fi: # Replace with a single Ko-fi username # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From cace5eb36c434e0d1302557ebc859bb8186a1a78 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Wed, 22 Jun 2022 16:00:41 +0200 Subject: [PATCH 09/24] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9391650..a776f2c 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,16 @@ - So To Get Started Using Functionalty.js Library,
You Have To Install It By npm - ```cmd + ```sh npm install functionality.js ``` -- Or You Can Install it By CDN In Your HTML File +- Or You Can Install it By yarn In Your HTML File + + ```sh + yarn add functionality.js + ``` + +- Or Even You Can Get it By CDN ```html From 7e0bfca79f95bbf9e4f1223bee2bc12adb728f9a Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 23 Jun 2022 15:22:00 +0200 Subject: [PATCH 10/24] Update index.js --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f4a3b38..8ea1234 100644 --- a/index.js +++ b/index.js @@ -1 +1,2 @@ -export {default as functionality} from './lib/main.js'; +import functionality from './lib/main.js'; +export default functionality From 41e747de4b089df4c613b206480e23985c008864 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 23 Jun 2022 16:46:35 +0200 Subject: [PATCH 11/24] adding new functions --- project/ts/functionality/converts/hexToHsl.ts | 77 +++++++++---------- project/ts/functionality/converts/hslToRgb.ts | 21 +++++ project/ts/functionality/main.ts | 6 +- 3 files changed, 60 insertions(+), 44 deletions(-) diff --git a/project/ts/functionality/converts/hexToHsl.ts b/project/ts/functionality/converts/hexToHsl.ts index 3225887..f11791c 100644 --- a/project/ts/functionality/converts/hexToHsl.ts +++ b/project/ts/functionality/converts/hexToHsl.ts @@ -1,42 +1,35 @@ -// // Convert hex to RGB first -// export default function hexToHsl(hex: string) { -// // Convert hex to RGB first -// let r, g, b; -// if (hex.length === 4) { -// r = "0x" + hex[1] + hex[1]; -// g = "0x" + hex[2] + hex[2]; -// b = "0x" + hex[3] + hex[3]; -// } else if (hex.length === 7) { -// r = "0x" + hex[1] + hex[2]; -// g = "0x" + hex[3] + hex[4]; -// b = "0x" + hex[5] + hex[6]; -// } -// // Then to HSL -// r /= 255; -// g /= 255; -// b /= 255; -// let cmin = Math.min(r, g, b), -// cmax = Math.max(r, g, b), -// delta = cmax - cmin, -// h = 0, -// s = 0, -// l = 0; - -// if (delta === 0) h = 0; -// else if (cmax === r) h = ((g - b) / delta) % 6; -// else if (cmax === g) h = (b - r) / delta + 2; -// else h = (r - g) / delta + 4; - -// h = Math.round(h * 60); - -// if (h < 0) h += 360; - -// l = (cmax + cmin) / 2; -// s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)); -// s = +(s * 100).toFixed(1); -// l = +(l * 100).toFixed(1); - -// console.log( -// "hsl(" + Math.round(h) + "," + Math.round(s) + "," + Math.round(l) + ")" -// ); -// } +export default function hexToHsl(hex: string): number[] { + let rgb = hex + .replace( + /^#?([a-f\d])([a-f\d])([a-f\d])$/i, + (m, r, g, b) => "#" + r + r + g + g + b + b + ) + .substring(1) + .match(/.{2}/g) + .map((x) => parseInt(x, 16)); + (rgb[0] /= 255), (rgb[1] /= 255), (rgb[2] /= 255); + var max = Math.max(rgb[0], rgb[1], rgb[2]), + min = Math.min(rgb[0], rgb[1], rgb[2]); + var h: number, + s: number, + l: number = (max + min) / 2; + if (max == min) { + h = s = 0; + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case rgb[0]: + h = (rgb[1] - rgb[2]) / d + (rgb[1] < rgb[2] ? 6 : 0); + break; + case rgb[1]: + h = (rgb[2] - rgb[1]) / d + 2; + break; + case rgb[2]: + h = (rgb[0] - rgb[1]) / d + 4; + break; + } + h /= 6; + } + return [h, s, l]; +} diff --git a/project/ts/functionality/converts/hslToRgb.ts b/project/ts/functionality/converts/hslToRgb.ts index e69de29..9ea5f1f 100644 --- a/project/ts/functionality/converts/hslToRgb.ts +++ b/project/ts/functionality/converts/hslToRgb.ts @@ -0,0 +1,21 @@ +/** + * Converts HSL color to RGB color + * + * @param {number} h + * @param {number} s + * @param {number} l + * @returns {number[]} + */ +export default function hslToRgb(h: number, s: number, l: number): number[] { + s /= 100; + l /= 100; + const k = (n: number) => (n + h / 30) % 12; + const a = s * Math.min(l, 1 - l); + const f = (n: number) => + l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1))); + return [ + Math.trunc(255 * f(0)), + Math.trunc(255 * f(8)), + Math.trunc(255 * f(4)), + ]; +} diff --git a/project/ts/functionality/main.ts b/project/ts/functionality/main.ts index 0537ab1..471b373 100644 --- a/project/ts/functionality/main.ts +++ b/project/ts/functionality/main.ts @@ -25,9 +25,9 @@ import randomPassword from "./randoms/randomPassword"; import rgbToHex from "./converts/rgbToHex"; import hexToRgb from "./converts/hexToRgb"; import rgbToHsl from "./converts/rgbToHsl"; -// import hexToHsl from "./converts/hexToHsl"; +import hexToHsl from "./converts/hexToHsl"; // import hslToHex from "./converts/hslToHex"; -// import hslToRgb from "./converts/hslToRgb"; +import hslToRgb from "./converts/hslToRgb"; import removeInnerSpace from "./strings/removeInnerSpace"; import getBrowser from "./user/getBrowser"; import getMonths from "./user/getMonths"; @@ -66,6 +66,8 @@ const functionality = { rgbToHex, hexToRgb, rgbToHsl, + hslToRgb, + hexToHsl, removeInnerSpace, getBrowser, getMonths, From 210880d1584955d84f7c822780f62ccc0eb65e6a Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 23 Jun 2022 17:00:06 +0200 Subject: [PATCH 12/24] adding new functions --- lib/converts/hexToHsl.d.ts | 1 + lib/converts/hexToHsl.js | 30 ++++++++++++++++ lib/converts/hslToRgb.d.ts | 9 +++++ lib/converts/hslToRgb.js | 20 +++++++++++ lib/converts/rgbToHsl.d.ts | 9 ++--- lib/converts/rgbToHsl.js | 9 ++--- lib/main.d.ts | 2 ++ lib/main.js | 3 +- project/ts/functionality/converts/hexToHsl.ts | 35 ------------------- project/ts/functionality/converts/rgbToHsl.ts | 9 ++--- project/ts/functionality/main.ts | 3 +- 11 files changed, 80 insertions(+), 50 deletions(-) create mode 100644 lib/converts/hexToHsl.d.ts create mode 100644 lib/converts/hexToHsl.js create mode 100644 lib/converts/hslToRgb.d.ts create mode 100644 lib/converts/hslToRgb.js delete mode 100644 project/ts/functionality/converts/hexToHsl.ts diff --git a/lib/converts/hexToHsl.d.ts b/lib/converts/hexToHsl.d.ts new file mode 100644 index 0000000..3ddab6e --- /dev/null +++ b/lib/converts/hexToHsl.d.ts @@ -0,0 +1 @@ +export default function hexToHsl(hex: string): number[]; diff --git a/lib/converts/hexToHsl.js b/lib/converts/hexToHsl.js new file mode 100644 index 0000000..96caf05 --- /dev/null +++ b/lib/converts/hexToHsl.js @@ -0,0 +1,30 @@ +export default function hexToHsl(hex) { + let rgb = hex + .replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => "#" + r + r + g + g + b + b) + .substring(1) + .match(/.{2}/g) + .map((x) => parseInt(x, 16)); + (rgb[0] /= 255), (rgb[1] /= 255), (rgb[2] /= 255); + var max = Math.max(rgb[0], rgb[1], rgb[2]), min = Math.min(rgb[0], rgb[1], rgb[2]); + var h, s, l = (max + min) / 2; + if (max == min) { + h = s = 0; + } + else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case rgb[0]: + h = (rgb[1] - rgb[2]) / d + (rgb[1] < rgb[2] ? 6 : 0); + break; + case rgb[1]: + h = (rgb[2] - rgb[1]) / d + 2; + break; + case rgb[2]: + h = (rgb[0] - rgb[1]) / d + 4; + break; + } + h /= 6; + } + return [h, s, l]; +} diff --git a/lib/converts/hslToRgb.d.ts b/lib/converts/hslToRgb.d.ts new file mode 100644 index 0000000..bc92384 --- /dev/null +++ b/lib/converts/hslToRgb.d.ts @@ -0,0 +1,9 @@ +/** + * Converts HSL color to RGB color + * + * @param {number} h + * @param {number} s + * @param {number} l + * @returns {number[]} + */ +export default function hslToRgb(h: number, s: number, l: number): number[]; diff --git a/lib/converts/hslToRgb.js b/lib/converts/hslToRgb.js new file mode 100644 index 0000000..b00408a --- /dev/null +++ b/lib/converts/hslToRgb.js @@ -0,0 +1,20 @@ +/** + * Converts HSL color to RGB color + * + * @param {number} h + * @param {number} s + * @param {number} l + * @returns {number[]} + */ +export default function hslToRgb(h, s, l) { + s /= 100; + l /= 100; + const k = (n) => (n + h / 30) % 12; + const a = s * Math.min(l, 1 - l); + const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1))); + return [ + Math.trunc(255 * f(0)), + Math.trunc(255 * f(8)), + Math.trunc(255 * f(4)), + ]; +} diff --git a/lib/converts/rgbToHsl.d.ts b/lib/converts/rgbToHsl.d.ts index cde8e96..38e5ed3 100644 --- a/lib/converts/rgbToHsl.d.ts +++ b/lib/converts/rgbToHsl.d.ts @@ -1,8 +1,9 @@ /** + * Converts RGB Color To HSL * - * @param r - * @param g - * @param b - * @returns + * @param {number} r + * @param {number} g + * @param {number} b + * @returns {number[]} */ export default function rgbToHsl(r: number, g: number, b: number): number[]; diff --git a/lib/converts/rgbToHsl.js b/lib/converts/rgbToHsl.js index cd339d5..973c43e 100644 --- a/lib/converts/rgbToHsl.js +++ b/lib/converts/rgbToHsl.js @@ -1,9 +1,10 @@ /** + * Converts RGB Color To HSL * - * @param r - * @param g - * @param b - * @returns + * @param {number} r + * @param {number} g + * @param {number} b + * @returns {number[]} */ export default function rgbToHsl(r, g, b) { (r /= 255), (g /= 255), (b /= 255); diff --git a/lib/main.d.ts b/lib/main.d.ts index 5c297a6..2382e6f 100644 --- a/lib/main.d.ts +++ b/lib/main.d.ts @@ -25,6 +25,7 @@ import randomPassword from "./randoms/randomPassword"; import rgbToHex from "./converts/rgbToHex"; import hexToRgb from "./converts/hexToRgb"; import rgbToHsl from "./converts/rgbToHsl"; +import hslToRgb from "./converts/hslToRgb"; import removeInnerSpace from "./strings/removeInnerSpace"; import getBrowser from "./user/getBrowser"; import getMonths from "./user/getMonths"; @@ -62,6 +63,7 @@ declare const functionality: { rgbToHex: typeof rgbToHex; hexToRgb: typeof hexToRgb; rgbToHsl: typeof rgbToHsl; + hslToRgb: typeof hslToRgb; removeInnerSpace: typeof removeInnerSpace; getBrowser: typeof getBrowser; getMonths: typeof getMonths; diff --git a/lib/main.js b/lib/main.js index fbfbc67..f8c216d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -27,7 +27,7 @@ import hexToRgb from "./converts/hexToRgb"; import rgbToHsl from "./converts/rgbToHsl"; // import hexToHsl from "./converts/hexToHsl"; // import hslToHex from "./converts/hslToHex"; -// import hslToRgb from "./converts/hslToRgb"; +import hslToRgb from "./converts/hslToRgb"; import removeInnerSpace from "./strings/removeInnerSpace"; import getBrowser from "./user/getBrowser"; import getMonths from "./user/getMonths"; @@ -65,6 +65,7 @@ const functionality = { rgbToHex, hexToRgb, rgbToHsl, + hslToRgb, removeInnerSpace, getBrowser, getMonths, diff --git a/project/ts/functionality/converts/hexToHsl.ts b/project/ts/functionality/converts/hexToHsl.ts deleted file mode 100644 index f11791c..0000000 --- a/project/ts/functionality/converts/hexToHsl.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default function hexToHsl(hex: string): number[] { - let rgb = hex - .replace( - /^#?([a-f\d])([a-f\d])([a-f\d])$/i, - (m, r, g, b) => "#" + r + r + g + g + b + b - ) - .substring(1) - .match(/.{2}/g) - .map((x) => parseInt(x, 16)); - (rgb[0] /= 255), (rgb[1] /= 255), (rgb[2] /= 255); - var max = Math.max(rgb[0], rgb[1], rgb[2]), - min = Math.min(rgb[0], rgb[1], rgb[2]); - var h: number, - s: number, - l: number = (max + min) / 2; - if (max == min) { - h = s = 0; - } else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case rgb[0]: - h = (rgb[1] - rgb[2]) / d + (rgb[1] < rgb[2] ? 6 : 0); - break; - case rgb[1]: - h = (rgb[2] - rgb[1]) / d + 2; - break; - case rgb[2]: - h = (rgb[0] - rgb[1]) / d + 4; - break; - } - h /= 6; - } - return [h, s, l]; -} diff --git a/project/ts/functionality/converts/rgbToHsl.ts b/project/ts/functionality/converts/rgbToHsl.ts index 8ece733..740dd9c 100644 --- a/project/ts/functionality/converts/rgbToHsl.ts +++ b/project/ts/functionality/converts/rgbToHsl.ts @@ -1,9 +1,10 @@ /** + * Converts RGB Color To HSL * - * @param r - * @param g - * @param b - * @returns + * @param {number} r + * @param {number} g + * @param {number} b + * @returns {number[]} */ export default function rgbToHsl(r: number, g: number, b: number): number[] { (r /= 255), (g /= 255), (b /= 255); diff --git a/project/ts/functionality/main.ts b/project/ts/functionality/main.ts index 471b373..1299516 100644 --- a/project/ts/functionality/main.ts +++ b/project/ts/functionality/main.ts @@ -25,7 +25,7 @@ import randomPassword from "./randoms/randomPassword"; import rgbToHex from "./converts/rgbToHex"; import hexToRgb from "./converts/hexToRgb"; import rgbToHsl from "./converts/rgbToHsl"; -import hexToHsl from "./converts/hexToHsl"; +// import hexToHsl from "./converts/hexToHsl"; // import hslToHex from "./converts/hslToHex"; import hslToRgb from "./converts/hslToRgb"; import removeInnerSpace from "./strings/removeInnerSpace"; @@ -67,7 +67,6 @@ const functionality = { hexToRgb, rgbToHsl, hslToRgb, - hexToHsl, removeInnerSpace, getBrowser, getMonths, From 7c910d415afa235f23ca241e2ce6aa985f2efc97 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 23 Jun 2022 17:33:47 +0200 Subject: [PATCH 13/24] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a776f2c..2906408 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ You Can Import Unminified Version ```html - import functionality from "functionality.js/lib/main"; + import functionality from "functionality.js"; ``` - Since You Have Downloaded And Imported The Library You Can Use It As Following ... @@ -74,19 +74,19 @@ - First Clone The Repository - ```cmd + ```sh git clone https://github.com/Ali-Eldeba/functionality.js.git ``` - Then Install Packages (node_modules) - ```cmd + ```sh npm install ``` - Run Website In Your Locahost Server With Live Reload - ```cmd + ```sh npm start ``` From 79bf9d0789e68e6359779d083ad51f70c9db1ae2 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 24 Jun 2022 12:07:36 +0200 Subject: [PATCH 14/24] adding new 2 functions --- project/ts/functionality/main.ts | 4 ++++ project/ts/functionality/numbers/addCommas.ts | 9 +++++++++ project/ts/functionality/user/getBirthDay.ts | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 project/ts/functionality/numbers/addCommas.ts create mode 100644 project/ts/functionality/user/getBirthDay.ts diff --git a/project/ts/functionality/main.ts b/project/ts/functionality/main.ts index 1299516..2fcfee8 100644 --- a/project/ts/functionality/main.ts +++ b/project/ts/functionality/main.ts @@ -16,6 +16,7 @@ import randomNumber from "./randoms/randomNumber"; import removeDuplicate from "./arrays/removeDuplicate"; import reverseString from "./strings/reverseString"; import reverseNumber from "./numbers/reverseNumber"; +import addCommas from "./numbers/addCommas"; import shuffle from "./arrays/shuffle"; import randomString from "./randoms/randomString"; import randomColor from "./randoms/randomColor"; @@ -36,6 +37,7 @@ import getDays from "./user/getDays"; import getHours from "./user/getHours"; import getMinutes from "./user/getMinutes"; import getSeconds from "./user/getSeconds"; +import getBirthDay from "./user/getBirthDay"; import select from "./dom/select"; const functionality = { @@ -54,6 +56,7 @@ const functionality = { randomElementFrom, randomHex, randomNumber, + addCommas, removeDuplicate, reverseString, reverseNumber, @@ -75,6 +78,7 @@ const functionality = { getHours, getSeconds, getMinutes, + getBirthDay, select, }; diff --git a/project/ts/functionality/numbers/addCommas.ts b/project/ts/functionality/numbers/addCommas.ts new file mode 100644 index 0000000..5f3eb8c --- /dev/null +++ b/project/ts/functionality/numbers/addCommas.ts @@ -0,0 +1,9 @@ +/** + * Returns Number With Commas To Facilitate Reading | e.g 1000000 => 1,000,000 + * + * @param {number} number + * @returns {string} + */ +export default function addCommas(number: number): string { + return number.toString().replace(/\B(? 15 + * + * @param {number} year + * @returns {number} + */ +export default function getBirthDay(year: number): number { + var currentDate = new Date(); + var currentYear = currentDate.getFullYear(); + return currentYear - year; +} From fbe5cc9bba39b9ded7595603589d15b9097ef225 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 24 Jun 2022 12:15:09 +0200 Subject: [PATCH 15/24] Delete functionalty.zip --- functionalty.zip | Bin 108 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 functionalty.zip diff --git a/functionalty.zip b/functionalty.zip deleted file mode 100644 index 09ed8203e6bc338d829dd93d66931c5fe227ca3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 108 zcmWIWW@Zs#VBlb2nAWu|gaHY#0@*2<#U=Uy-i%E4%(xZ7^!#-Mv7lO5*+3jdAT$Qj I${-E{0OJV^8vp Date: Fri, 24 Jun 2022 12:45:47 +0200 Subject: [PATCH 16/24] updating buils --- lib/numbers/addCommas.d.ts | 7 +++++++ lib/numbers/addCommas.js | 9 +++++++++ lib/user/getBirthDay.d.ts | 7 +++++++ lib/user/getBirthDay.js | 11 +++++++++++ package.json | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 lib/numbers/addCommas.d.ts create mode 100644 lib/numbers/addCommas.js create mode 100644 lib/user/getBirthDay.d.ts create mode 100644 lib/user/getBirthDay.js diff --git a/lib/numbers/addCommas.d.ts b/lib/numbers/addCommas.d.ts new file mode 100644 index 0000000..b73cc6c --- /dev/null +++ b/lib/numbers/addCommas.d.ts @@ -0,0 +1,7 @@ +/** + * Returns Number With Commas To Facilitate Reading | e.g 1000000 => 1,000,000 + * + * @param {number} number + * @returns {string} + */ +export default function addCommas(number: number): string; diff --git a/lib/numbers/addCommas.js b/lib/numbers/addCommas.js new file mode 100644 index 0000000..6a2c0e7 --- /dev/null +++ b/lib/numbers/addCommas.js @@ -0,0 +1,9 @@ +/** + * Returns Number With Commas To Facilitate Reading | e.g 1000000 => 1,000,000 + * + * @param {number} number + * @returns {string} + */ +export default function addCommas(number) { + return number.toString().replace(/\B(? 15 + * + * @param {number} year + * @returns {number} + */ +export default function getBirthDay(year: number): number; diff --git a/lib/user/getBirthDay.js b/lib/user/getBirthDay.js new file mode 100644 index 0000000..8fd4b46 --- /dev/null +++ b/lib/user/getBirthDay.js @@ -0,0 +1,11 @@ +/** + * Returns the Age From a Given Year | e.g 2007 -> 15 + * + * @param {number} year + * @returns {number} + */ +export default function getBirthDay(year) { + var currentDate = new Date(); + var currentYear = currentDate.getFullYear(); + return currentYear - year; +} diff --git a/package.json b/package.json index 33b948a..fa07779 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "functionality.js", "entry": "index.js", - "version": "3.2.1", + "version": "3.2.3", "description": "- This Is A JavaScript Library To Make Your Work Easier/Faster,
\r You Can See Functionalty.js Website From Here\r - Born In May 5 / 16 / 2022", "main": "index.js", "scripts": { From 235ea103091f7c9e7b3a24aa77abafd2455f4e5c Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Sat, 25 Jun 2022 04:55:03 +0200 Subject: [PATCH 17/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2906408..6d2603a 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ - Run Website In Your Locahost Server With Live Reload ```sh - npm start + npm run dev ``` - Feel Free To Add What You Want! From 7d639031e3596f733c03126142df55d75712cbe6 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 1 Jul 2022 14:28:03 +0200 Subject: [PATCH 18/24] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6d2603a..2c11b9b 100644 --- a/README.md +++ b/README.md @@ -89,5 +89,11 @@ ```sh npm run dev ``` + +- Run the Build + + ```sh + npm run build-npm + ``` - Feel Free To Add What You Want! From 59719747b37dca58f0397fa8484a1860e1099e1f Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 14 Jul 2022 21:36:42 +0200 Subject: [PATCH 19/24] adding npm keywords and copy (beta) function --- .gitignore | 5 ++- LICENSE | 2 +- dist/index.html | 19 +++++------ futureFunctions.txt | 7 +--- lib/main.d.ts | 8 ++++- lib/main.js | 8 ++++- lib/user/copy.d.ts | 1 + lib/user/copy.js | 7 ++++ lib/user/getBirthDay.d.ts | 2 +- lib/user/getBirthDay.js | 2 +- package.json | 9 +++-- .../functionality => }/arrays/ascending.ts | 0 .../functionality => }/arrays/descending.ts | 0 .../functionality => }/arrays/filterArray.ts | 0 .../functionality => }/arrays/getFactors.ts | 0 .../{ts/functionality => }/arrays/maxArray.ts | 0 .../{ts/functionality => }/arrays/minArray.ts | 0 .../arrays/randomElementFrom.ts | 0 .../arrays/removeDuplicate.ts | 0 .../{ts/functionality => }/arrays/shuffle.ts | 0 .../functionality => }/arrays/sumOfArray.ts | 0 .../functionality => }/converts/hexToRgb.ts | 0 .../functionality => }/converts/hslToHex.ts | 0 .../functionality => }/converts/hslToRgb.ts | 0 .../functionality => }/converts/rgbToHex.ts | 0 .../functionality => }/converts/rgbToHsl.ts | 0 project/dist/functionality.min.js | 1 + project/dist/index.html | 24 ++++++++++++++ project/{ts/functionality => }/dom/select.ts | 0 project/index.html | 26 +++++++++++++++ project/{ts/functionality => }/main.js | 33 ++++++++++++++++++- project/{ts/functionality => }/main.ts | 8 +++-- .../functionality => }/numbers/addCommas.ts | 0 .../{ts/functionality => }/numbers/getMid.ts | 0 .../{ts/functionality => }/numbers/isEven.ts | 0 .../numbers/isHappyNumber.ts | 0 .../{ts/functionality => }/numbers/isOdd.ts | 0 .../{ts/functionality => }/numbers/isPrime.ts | 0 .../numbers/reverseNumber.ts | 0 .../randoms/randomBoolean.ts | 0 .../functionality => }/randoms/randomColor.ts | 0 .../functionality => }/randoms/randomHex.ts | 0 .../functionality => }/randoms/randomHsl.ts | 0 .../randoms/randomNumber.ts | 0 .../randoms/randomPassword.ts | 0 .../randoms/randomString.ts | 0 .../functionality => }/strings/capitalize.ts | 0 .../strings/isPalindrome.ts | 0 .../strings/removeInnerSpace.ts | 0 .../strings/reverseString.ts | 0 project/ts/functionality/index.html | 15 --------- project/ts/functionality/user/getMinutes.ts | 12 ------- project/ts/functionality/user/getMonths.ts | 12 ------- project/user/copy.ts | 10 ++++++ .../getBirthDay.ts => user/getBirthday.ts} | 4 +-- .../{ts/functionality => }/user/getBrowser.ts | 0 .../{ts/functionality => }/user/getDays.ts | 0 .../{ts/functionality => }/user/getHours.ts | 4 +-- project/user/getMinutes.ts | 12 +++++++ project/user/getMonths.ts | 12 +++++++ .../{ts/functionality => }/user/getSeconds.ts | 10 +++--- .../{ts/functionality => }/user/getWeeks.ts | 4 +-- tsconfig.json | 2 +- tsconfig.npm.json | 7 ++-- vite.config.ts | 12 +++---- 65 files changed, 188 insertions(+), 90 deletions(-) create mode 100644 lib/user/copy.d.ts create mode 100644 lib/user/copy.js rename project/{ts/functionality => }/arrays/ascending.ts (100%) rename project/{ts/functionality => }/arrays/descending.ts (100%) rename project/{ts/functionality => }/arrays/filterArray.ts (100%) rename project/{ts/functionality => }/arrays/getFactors.ts (100%) rename project/{ts/functionality => }/arrays/maxArray.ts (100%) rename project/{ts/functionality => }/arrays/minArray.ts (100%) rename project/{ts/functionality => }/arrays/randomElementFrom.ts (100%) rename project/{ts/functionality => }/arrays/removeDuplicate.ts (100%) rename project/{ts/functionality => }/arrays/shuffle.ts (100%) rename project/{ts/functionality => }/arrays/sumOfArray.ts (100%) rename project/{ts/functionality => }/converts/hexToRgb.ts (100%) rename project/{ts/functionality => }/converts/hslToHex.ts (100%) rename project/{ts/functionality => }/converts/hslToRgb.ts (100%) rename project/{ts/functionality => }/converts/rgbToHex.ts (100%) rename project/{ts/functionality => }/converts/rgbToHsl.ts (100%) create mode 100644 project/dist/functionality.min.js create mode 100644 project/dist/index.html rename project/{ts/functionality => }/dom/select.ts (100%) create mode 100644 project/index.html rename project/{ts/functionality => }/main.js (62%) rename project/{ts/functionality => }/main.ts (96%) rename project/{ts/functionality => }/numbers/addCommas.ts (100%) rename project/{ts/functionality => }/numbers/getMid.ts (100%) rename project/{ts/functionality => }/numbers/isEven.ts (100%) rename project/{ts/functionality => }/numbers/isHappyNumber.ts (100%) rename project/{ts/functionality => }/numbers/isOdd.ts (100%) rename project/{ts/functionality => }/numbers/isPrime.ts (100%) rename project/{ts/functionality => }/numbers/reverseNumber.ts (100%) rename project/{ts/functionality => }/randoms/randomBoolean.ts (100%) rename project/{ts/functionality => }/randoms/randomColor.ts (100%) rename project/{ts/functionality => }/randoms/randomHex.ts (100%) rename project/{ts/functionality => }/randoms/randomHsl.ts (100%) rename project/{ts/functionality => }/randoms/randomNumber.ts (100%) rename project/{ts/functionality => }/randoms/randomPassword.ts (100%) rename project/{ts/functionality => }/randoms/randomString.ts (100%) rename project/{ts/functionality => }/strings/capitalize.ts (100%) rename project/{ts/functionality => }/strings/isPalindrome.ts (100%) rename project/{ts/functionality => }/strings/removeInnerSpace.ts (100%) rename project/{ts/functionality => }/strings/reverseString.ts (100%) delete mode 100644 project/ts/functionality/index.html delete mode 100644 project/ts/functionality/user/getMinutes.ts delete mode 100644 project/ts/functionality/user/getMonths.ts create mode 100644 project/user/copy.ts rename project/{ts/functionality/user/getBirthDay.ts => user/getBirthday.ts} (77%) rename project/{ts/functionality => }/user/getBrowser.ts (100%) rename project/{ts/functionality => }/user/getDays.ts (100%) rename project/{ts/functionality => }/user/getHours.ts (80%) create mode 100644 project/user/getMinutes.ts create mode 100644 project/user/getMonths.ts rename project/{ts/functionality => }/user/getSeconds.ts (50%) rename project/{ts/functionality => }/user/getWeeks.ts (79%) diff --git a/.gitignore b/.gitignore index 6a60a8e..1122c7d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,7 @@ ehthumbs_vista.db *.msi *.msix *.msm -*.msp \ No newline at end of file +*.msp + +# Small Unimportant files +futureFunctions.txt \ No newline at end of file diff --git a/LICENSE b/LICENSE index 23727dd..4436283 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License Copyright (c) 2022 Functionalty.js -Copyright (c) 2022 Ali-Eldeba +Copyright (c) 2022 alieldeba Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dist/index.html b/dist/index.html index 411e5d0..63fd6ed 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,13 +1,10 @@ - - - Title - - - - - - - - \ No newline at end of file + + + functionality.js + + + + + diff --git a/futureFunctions.txt b/futureFunctions.txt index 83ec111..f1be9f8 100644 --- a/futureFunctions.txt +++ b/futureFunctions.txt @@ -1,6 +1 @@ -- Arrays - - zip -- Strings -- Numbers -- Numbers -- randoms \ No newline at end of file +- zip \ No newline at end of file diff --git a/lib/main.d.ts b/lib/main.d.ts index 2382e6f..2ce4447 100644 --- a/lib/main.d.ts +++ b/lib/main.d.ts @@ -16,6 +16,7 @@ import randomNumber from "./randoms/randomNumber"; import removeDuplicate from "./arrays/removeDuplicate"; import reverseString from "./strings/reverseString"; import reverseNumber from "./numbers/reverseNumber"; +import addCommas from "./numbers/addCommas"; import shuffle from "./arrays/shuffle"; import randomString from "./randoms/randomString"; import randomColor from "./randoms/randomColor"; @@ -34,6 +35,8 @@ import getDays from "./user/getDays"; import getHours from "./user/getHours"; import getMinutes from "./user/getMinutes"; import getSeconds from "./user/getSeconds"; +import getBirthday from "./user/getBirthday"; +import copy from "./user/copy"; import select from "./dom/select"; declare const functionality: { sumOfArray: typeof sumOfArray; @@ -51,6 +54,7 @@ declare const functionality: { randomElementFrom: typeof randomElementFrom; randomHex: typeof randomHex; randomNumber: typeof randomNumber; + addCommas: typeof addCommas; removeDuplicate: typeof removeDuplicate; reverseString: typeof reverseString; reverseNumber: typeof reverseNumber; @@ -70,8 +74,10 @@ declare const functionality: { getWeeks: typeof getWeeks; getDays: typeof getDays; getHours: typeof getHours; - getSeconds: typeof getSeconds; getMinutes: typeof getMinutes; + getSeconds: typeof getSeconds; + getBirthday: typeof getBirthday; + copy: typeof copy; select: typeof select; }; declare global { diff --git a/lib/main.js b/lib/main.js index f8c216d..73d4f5a 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,6 +16,7 @@ import randomNumber from "./randoms/randomNumber"; import removeDuplicate from "./arrays/removeDuplicate"; import reverseString from "./strings/reverseString"; import reverseNumber from "./numbers/reverseNumber"; +import addCommas from "./numbers/addCommas"; import shuffle from "./arrays/shuffle"; import randomString from "./randoms/randomString"; import randomColor from "./randoms/randomColor"; @@ -36,6 +37,8 @@ import getDays from "./user/getDays"; import getHours from "./user/getHours"; import getMinutes from "./user/getMinutes"; import getSeconds from "./user/getSeconds"; +import getBirthday from "./user/getBirthday"; +import copy from "./user/copy"; import select from "./dom/select"; const functionality = { sumOfArray, @@ -53,6 +56,7 @@ const functionality = { randomElementFrom, randomHex, randomNumber, + addCommas, removeDuplicate, reverseString, reverseNumber, @@ -72,8 +76,10 @@ const functionality = { getWeeks, getDays, getHours, - getSeconds, getMinutes, + getSeconds, + getBirthday, + copy, select, }; window.functionality = functionality; diff --git a/lib/user/copy.d.ts b/lib/user/copy.d.ts new file mode 100644 index 0000000..002661b --- /dev/null +++ b/lib/user/copy.d.ts @@ -0,0 +1 @@ +export default function copy(text: string): void; diff --git a/lib/user/copy.js b/lib/user/copy.js new file mode 100644 index 0000000..7a04c1f --- /dev/null +++ b/lib/user/copy.js @@ -0,0 +1,7 @@ +export default function copy(text) { + navigator.clipboard.writeText(text).then(function () { + console.log("Async: Copying to clipboard was successful!"); + }, function (err) { + console.error("Async: Could not copy text: ", err); + }); +} diff --git a/lib/user/getBirthDay.d.ts b/lib/user/getBirthDay.d.ts index 5e06f5e..879339a 100644 --- a/lib/user/getBirthDay.d.ts +++ b/lib/user/getBirthDay.d.ts @@ -4,4 +4,4 @@ * @param {number} year * @returns {number} */ -export default function getBirthDay(year: number): number; +export default function getBirthday(year: number): number; diff --git a/lib/user/getBirthDay.js b/lib/user/getBirthDay.js index 8fd4b46..7939aa5 100644 --- a/lib/user/getBirthDay.js +++ b/lib/user/getBirthDay.js @@ -4,7 +4,7 @@ * @param {number} year * @returns {number} */ -export default function getBirthDay(year) { +export default function getBirthday(year) { var currentDate = new Date(); var currentYear = currentDate.getFullYear(); return currentYear - year; diff --git a/package.json b/package.json index fa07779..d99d7b4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,14 @@ "entry": "index.js", "version": "3.2.3", "description": "- This Is A JavaScript Library To Make Your Work Easier/Faster,
\r You Can See Functionalty.js Website From Here\r - Born In May 5 / 16 / 2022", + "homepage": "https://github.com/Ali-Eldeba/functionalty.js#readme", + "author": "alieldeba", "main": "index.js", + "keywords": [ + "functionality", + "javascript", + "modules" + ], "scripts": { "test": "jest --watchAll", "dev": "node server.js", @@ -14,12 +21,10 @@ "type": "git", "url": "git+https://github.com/Ali-Eldeba/functionalty.js.git" }, - "author": "Ali-Eldeba", "license": "ISC", "bugs": { "url": "https://github.com/Ali-Eldeba/functionalty.js/issues" }, - "homepage": "https://github.com/Ali-Eldeba/functionalty.js#readme", "devDependencies": { "jest": "^26.6.3", "sass": "^1.52.0", diff --git a/project/ts/functionality/arrays/ascending.ts b/project/arrays/ascending.ts similarity index 100% rename from project/ts/functionality/arrays/ascending.ts rename to project/arrays/ascending.ts diff --git a/project/ts/functionality/arrays/descending.ts b/project/arrays/descending.ts similarity index 100% rename from project/ts/functionality/arrays/descending.ts rename to project/arrays/descending.ts diff --git a/project/ts/functionality/arrays/filterArray.ts b/project/arrays/filterArray.ts similarity index 100% rename from project/ts/functionality/arrays/filterArray.ts rename to project/arrays/filterArray.ts diff --git a/project/ts/functionality/arrays/getFactors.ts b/project/arrays/getFactors.ts similarity index 100% rename from project/ts/functionality/arrays/getFactors.ts rename to project/arrays/getFactors.ts diff --git a/project/ts/functionality/arrays/maxArray.ts b/project/arrays/maxArray.ts similarity index 100% rename from project/ts/functionality/arrays/maxArray.ts rename to project/arrays/maxArray.ts diff --git a/project/ts/functionality/arrays/minArray.ts b/project/arrays/minArray.ts similarity index 100% rename from project/ts/functionality/arrays/minArray.ts rename to project/arrays/minArray.ts diff --git a/project/ts/functionality/arrays/randomElementFrom.ts b/project/arrays/randomElementFrom.ts similarity index 100% rename from project/ts/functionality/arrays/randomElementFrom.ts rename to project/arrays/randomElementFrom.ts diff --git a/project/ts/functionality/arrays/removeDuplicate.ts b/project/arrays/removeDuplicate.ts similarity index 100% rename from project/ts/functionality/arrays/removeDuplicate.ts rename to project/arrays/removeDuplicate.ts diff --git a/project/ts/functionality/arrays/shuffle.ts b/project/arrays/shuffle.ts similarity index 100% rename from project/ts/functionality/arrays/shuffle.ts rename to project/arrays/shuffle.ts diff --git a/project/ts/functionality/arrays/sumOfArray.ts b/project/arrays/sumOfArray.ts similarity index 100% rename from project/ts/functionality/arrays/sumOfArray.ts rename to project/arrays/sumOfArray.ts diff --git a/project/ts/functionality/converts/hexToRgb.ts b/project/converts/hexToRgb.ts similarity index 100% rename from project/ts/functionality/converts/hexToRgb.ts rename to project/converts/hexToRgb.ts diff --git a/project/ts/functionality/converts/hslToHex.ts b/project/converts/hslToHex.ts similarity index 100% rename from project/ts/functionality/converts/hslToHex.ts rename to project/converts/hslToHex.ts diff --git a/project/ts/functionality/converts/hslToRgb.ts b/project/converts/hslToRgb.ts similarity index 100% rename from project/ts/functionality/converts/hslToRgb.ts rename to project/converts/hslToRgb.ts diff --git a/project/ts/functionality/converts/rgbToHex.ts b/project/converts/rgbToHex.ts similarity index 100% rename from project/ts/functionality/converts/rgbToHex.ts rename to project/converts/rgbToHex.ts diff --git a/project/ts/functionality/converts/rgbToHsl.ts b/project/converts/rgbToHsl.ts similarity index 100% rename from project/ts/functionality/converts/rgbToHsl.ts rename to project/converts/rgbToHsl.ts diff --git a/project/dist/functionality.min.js b/project/dist/functionality.min.js new file mode 100644 index 0000000..963f0a5 --- /dev/null +++ b/project/dist/functionality.min.js @@ -0,0 +1 @@ +const U=function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerpolicy&&(o.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?o.credentials="include":n.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(n){if(n.ep)return;n.ep=!0;const o=t(n);fetch(n.href,o)}};U();function l(e){if(!Array.isArray(e)||e.some(r=>typeof r!="number"))throw new TypeError("Expected an array of numbers but got "+(Array.isArray(e)?"array":typeof e));return e.reduce((r,t)=>r+t,0)}function c(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e?e.charAt(0).toUpperCase()+e.slice(1):""}function s(e,r){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e.filter(t=>t!=r)}function p(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return[...Array(e+1).keys()].filter(r=>e%r===0)}function y(e=0,r){return typeof e!="number"&&!r?0:!r&&typeof+e=="number"?e:isNaN(+e)||isNaN(+r)?0:Math.floor((+e+ +r)/2)}function h(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2==0}function d(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2!=0}function g(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);for(let r=2,t=Math.sqrt(e);r<=t;r++)if(e%r===0)return!1;return!0}function m(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.max(...e)}function w(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.min(...e)}function M(){return Math.random()>=.5}function E(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e[Math.floor(Math.random()*e.length)]}function S(){return`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`}function b(e,r){if(typeof e!="number"||typeof r!="number")throw new TypeError("Expected numbers but got "+typeof e+" and "+typeof r);return Math.floor(Math.random()*(r-e+1)+e)}function k(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);e.filter(function(r,t){return[...new Set(e)]})}function T(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return!e||typeof e!="string"?"":e.split("").reverse().join("")}function B(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);if(e==0)return 0;if(e<10&&e>-10)return e;const r=+(e>10?e:e*-1).toString().split("").reverse().join("");return e>10?r:r*-1}function G(e){return e.toString().replace(new RegExp("\\B(?.5-Math.random())}function v(e=5){if(typeof e!="number")throw new TypeError("Expected numbers but got "+typeof e);for(var r="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length,n=0;n0;)t+=Math.pow(e%10,2),e=Math.floor(e/10);e=t}return e===1}function P(){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()_-+={[}]|\\:;\"'<,>.?/~`!";let r="";for(let t=0;t<12;t++)r+=e[Math.floor(Math.random()*e.length)];return r}function C(e,r,t){return"#"+((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1)}function O(e){return e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(r,t,i,n)=>"#"+t+t+i+i+n+n).substring(1).match(/.{2}/g).map(r=>parseInt(r,16))}function R(e,r,t){e/=255,r/=255,t/=255;var i=Math.max(e,r,t),n=Math.min(e,r,t),o,a,f=(i+n)/2;if(i==n)o=a=0;else{var u=i-n;switch(a=f>.5?u/(2-i-n):u/(i+n),i){case e:o=(r-t)/u+(r(a+e/30)%12,n=r*Math.min(t,1-t),o=a=>t-n*Math.max(-1,Math.min(i(a)-3,Math.min(9-i(a),1)));return[Math.trunc(255*o(0)),Math.trunc(255*o(8)),Math.trunc(255*o(4))]}function W(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.replace(/\s+/g," ")}function q(){return navigator.userAgent.split(" ")[navigator.userAgent.split(" ").length-1]}function F(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12}function Y(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*4}function H(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*4*7}function $(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24}function I(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24*60}function V(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24*60*60}function _(e){var r=new Date,t=r.getFullYear();return t-e}function j(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return document.querySelector(e)}const K={sumOfArray:l,capitalize:c,filterArray:s,getFactors:p,getMid:y,isEven:h,isOdd:d,isPrime:g,isPalindrome:z,maxArray:m,minArray:w,randomBoolean:M,randomElementFrom:E,randomHex:S,randomNumber:b,addCommas:G,removeDuplicate:k,reverseString:T,reverseNumber:B,shuffle:A,randomString:v,randomColor:x,randomHsl:D,isHappyNumber:L,randomPassword:P,rgbToHex:C,hexToRgb:O,rgbToHsl:R,hslToRgb:N,removeInnerSpace:W,getBrowser:q,getMonths:F,getWeeks:Y,getDays:H,getHours:$,getSeconds:V,getMinutes:I,getBirthDay:_,select:j};window.functionality=K;function z(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.toString()==K.reverseString(e.toString())}function J(e){var r=new Date,t=r.getFullYear();return t-e}function Q(e){navigator.clipboard.writeText(e).then(function(){console.log("Async: Copying to clipboard was successful!")},function(r){console.error("Async: Could not copy text: ",r)})}const X={sumOfArray:l,capitalize:c,filterArray:s,getFactors:p,getMid:y,isEven:h,isOdd:d,isPrime:g,isPalindrome:z,maxArray:m,minArray:w,randomBoolean:M,randomElementFrom:E,randomHex:S,randomNumber:b,addCommas:G,removeDuplicate:k,reverseString:T,reverseNumber:B,shuffle:A,randomString:v,randomColor:x,randomHsl:D,isHappyNumber:L,randomPassword:P,rgbToHex:C,hexToRgb:O,rgbToHsl:R,hslToRgb:N,removeInnerSpace:W,getBrowser:q,getMonths:F,getWeeks:Y,getDays:H,getHours:$,getMinutes:I,getSeconds:V,getBirthday:J,copy:Q,select:j};window.functionality=X; diff --git a/project/dist/index.html b/project/dist/index.html new file mode 100644 index 0000000..19fbc02 --- /dev/null +++ b/project/dist/index.html @@ -0,0 +1,24 @@ + + + + + functionality.js + + + + +

Thanks for contributing to functionality.js Library ❤🙏

+ + + + diff --git a/project/ts/functionality/dom/select.ts b/project/dom/select.ts similarity index 100% rename from project/ts/functionality/dom/select.ts rename to project/dom/select.ts diff --git a/project/index.html b/project/index.html new file mode 100644 index 0000000..86c1140 --- /dev/null +++ b/project/index.html @@ -0,0 +1,26 @@ + + + + + functionality.js + + + +

Thanks for contributing to functionality.js Library ❤🙏

+ + + + diff --git a/project/ts/functionality/main.js b/project/main.js similarity index 62% rename from project/ts/functionality/main.js rename to project/main.js index 76a682a..79fa3fd 100644 --- a/project/ts/functionality/main.js +++ b/project/main.js @@ -16,12 +16,29 @@ import randomNumber from "./randoms/randomNumber"; import removeDuplicate from "./arrays/removeDuplicate"; import reverseString from "./strings/reverseString"; import reverseNumber from "./numbers/reverseNumber"; +import addCommas from "./numbers/addCommas"; import shuffle from "./arrays/shuffle"; import randomString from "./randoms/randomString"; import randomColor from "./randoms/randomColor"; import randomHsl from "./randoms/randomHsl"; import isHappyNumber from "./numbers/isHappyNumber"; import randomPassword from "./randoms/randomPassword"; +import rgbToHex from "./converts/rgbToHex"; +import hexToRgb from "./converts/hexToRgb"; +import rgbToHsl from "./converts/rgbToHsl"; +// import hexToHsl from "./converts/hexToHsl"; +// import hslToHex from "./converts/hslToHex"; +import hslToRgb from "./converts/hslToRgb"; +import removeInnerSpace from "./strings/removeInnerSpace"; +import getBrowser from "./user/getBrowser"; +import getMonths from "./user/getMonths"; +import getWeeks from "./user/getWeeks"; +import getDays from "./user/getDays"; +import getHours from "./user/getHours"; +import getMinutes from "./user/getMinutes"; +import getSeconds from "./user/getSeconds"; +import getBirthDay from "./user/getBirthDay"; +import select from "./dom/select"; const functionality = { sumOfArray, capitalize, @@ -38,6 +55,7 @@ const functionality = { randomElementFrom, randomHex, randomNumber, + addCommas, removeDuplicate, reverseString, reverseNumber, @@ -47,7 +65,20 @@ const functionality = { randomHsl, isHappyNumber, randomPassword, + rgbToHex, + hexToRgb, + rgbToHsl, + hslToRgb, + removeInnerSpace, + getBrowser, + getMonths, + getWeeks, + getDays, + getHours, + getSeconds, + getMinutes, + getBirthDay, + select, }; window.functionality = functionality; -// export * from "./sumOfArray"; export default functionality; diff --git a/project/ts/functionality/main.ts b/project/main.ts similarity index 96% rename from project/ts/functionality/main.ts rename to project/main.ts index 2fcfee8..b5a6cce 100644 --- a/project/ts/functionality/main.ts +++ b/project/main.ts @@ -37,7 +37,8 @@ import getDays from "./user/getDays"; import getHours from "./user/getHours"; import getMinutes from "./user/getMinutes"; import getSeconds from "./user/getSeconds"; -import getBirthDay from "./user/getBirthDay"; +import getBirthday from "./user/getBirthday"; +import copy from "./user/copy"; import select from "./dom/select"; const functionality = { @@ -76,9 +77,10 @@ const functionality = { getWeeks, getDays, getHours, - getSeconds, getMinutes, - getBirthDay, + getSeconds, + getBirthday, + copy, select, }; diff --git a/project/ts/functionality/numbers/addCommas.ts b/project/numbers/addCommas.ts similarity index 100% rename from project/ts/functionality/numbers/addCommas.ts rename to project/numbers/addCommas.ts diff --git a/project/ts/functionality/numbers/getMid.ts b/project/numbers/getMid.ts similarity index 100% rename from project/ts/functionality/numbers/getMid.ts rename to project/numbers/getMid.ts diff --git a/project/ts/functionality/numbers/isEven.ts b/project/numbers/isEven.ts similarity index 100% rename from project/ts/functionality/numbers/isEven.ts rename to project/numbers/isEven.ts diff --git a/project/ts/functionality/numbers/isHappyNumber.ts b/project/numbers/isHappyNumber.ts similarity index 100% rename from project/ts/functionality/numbers/isHappyNumber.ts rename to project/numbers/isHappyNumber.ts diff --git a/project/ts/functionality/numbers/isOdd.ts b/project/numbers/isOdd.ts similarity index 100% rename from project/ts/functionality/numbers/isOdd.ts rename to project/numbers/isOdd.ts diff --git a/project/ts/functionality/numbers/isPrime.ts b/project/numbers/isPrime.ts similarity index 100% rename from project/ts/functionality/numbers/isPrime.ts rename to project/numbers/isPrime.ts diff --git a/project/ts/functionality/numbers/reverseNumber.ts b/project/numbers/reverseNumber.ts similarity index 100% rename from project/ts/functionality/numbers/reverseNumber.ts rename to project/numbers/reverseNumber.ts diff --git a/project/ts/functionality/randoms/randomBoolean.ts b/project/randoms/randomBoolean.ts similarity index 100% rename from project/ts/functionality/randoms/randomBoolean.ts rename to project/randoms/randomBoolean.ts diff --git a/project/ts/functionality/randoms/randomColor.ts b/project/randoms/randomColor.ts similarity index 100% rename from project/ts/functionality/randoms/randomColor.ts rename to project/randoms/randomColor.ts diff --git a/project/ts/functionality/randoms/randomHex.ts b/project/randoms/randomHex.ts similarity index 100% rename from project/ts/functionality/randoms/randomHex.ts rename to project/randoms/randomHex.ts diff --git a/project/ts/functionality/randoms/randomHsl.ts b/project/randoms/randomHsl.ts similarity index 100% rename from project/ts/functionality/randoms/randomHsl.ts rename to project/randoms/randomHsl.ts diff --git a/project/ts/functionality/randoms/randomNumber.ts b/project/randoms/randomNumber.ts similarity index 100% rename from project/ts/functionality/randoms/randomNumber.ts rename to project/randoms/randomNumber.ts diff --git a/project/ts/functionality/randoms/randomPassword.ts b/project/randoms/randomPassword.ts similarity index 100% rename from project/ts/functionality/randoms/randomPassword.ts rename to project/randoms/randomPassword.ts diff --git a/project/ts/functionality/randoms/randomString.ts b/project/randoms/randomString.ts similarity index 100% rename from project/ts/functionality/randoms/randomString.ts rename to project/randoms/randomString.ts diff --git a/project/ts/functionality/strings/capitalize.ts b/project/strings/capitalize.ts similarity index 100% rename from project/ts/functionality/strings/capitalize.ts rename to project/strings/capitalize.ts diff --git a/project/ts/functionality/strings/isPalindrome.ts b/project/strings/isPalindrome.ts similarity index 100% rename from project/ts/functionality/strings/isPalindrome.ts rename to project/strings/isPalindrome.ts diff --git a/project/ts/functionality/strings/removeInnerSpace.ts b/project/strings/removeInnerSpace.ts similarity index 100% rename from project/ts/functionality/strings/removeInnerSpace.ts rename to project/strings/removeInnerSpace.ts diff --git a/project/ts/functionality/strings/reverseString.ts b/project/strings/reverseString.ts similarity index 100% rename from project/ts/functionality/strings/reverseString.ts rename to project/strings/reverseString.ts diff --git a/project/ts/functionality/index.html b/project/ts/functionality/index.html deleted file mode 100644 index ab10b16..0000000 --- a/project/ts/functionality/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Title - - - - - - - \ No newline at end of file diff --git a/project/ts/functionality/user/getMinutes.ts b/project/ts/functionality/user/getMinutes.ts deleted file mode 100644 index b658d1b..0000000 --- a/project/ts/functionality/user/getMinutes.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * returns the number of minutes in a given age - * - * @param {number} age - * @returns {number} - */ -export default function getWeeks(age: number): number { - if (typeof age !== "number") { - throw new TypeError("Expected a number but got " + typeof age); - } - return age * 12 * 7 * 4 * 24 * 60; -} diff --git a/project/ts/functionality/user/getMonths.ts b/project/ts/functionality/user/getMonths.ts deleted file mode 100644 index 5b816ab..0000000 --- a/project/ts/functionality/user/getMonths.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * returns the months of the age - * - * @param {number} age - * @returns {number} - */ -export default function getMonths(age: number): number { - if (typeof age !== "number") { - throw new TypeError("Expected a number but got " + typeof age); - } - return age * 12; -} diff --git a/project/user/copy.ts b/project/user/copy.ts new file mode 100644 index 0000000..dc6288e --- /dev/null +++ b/project/user/copy.ts @@ -0,0 +1,10 @@ +export default function copy(text: string): void { + navigator.clipboard.writeText(text).then( + function () { + console.log("Async: Copying to clipboard was successful!"); + }, + function (err) { + console.error("Async: Could not copy text: ", err); + } + ); +} diff --git a/project/ts/functionality/user/getBirthDay.ts b/project/user/getBirthday.ts similarity index 77% rename from project/ts/functionality/user/getBirthDay.ts rename to project/user/getBirthday.ts index 71e113a..cf1cae2 100644 --- a/project/ts/functionality/user/getBirthDay.ts +++ b/project/user/getBirthday.ts @@ -4,8 +4,8 @@ * @param {number} year * @returns {number} */ -export default function getBirthDay(year: number): number { + export default function getBirthday(year: number): number { var currentDate = new Date(); var currentYear = currentDate.getFullYear(); return currentYear - year; -} +} \ No newline at end of file diff --git a/project/ts/functionality/user/getBrowser.ts b/project/user/getBrowser.ts similarity index 100% rename from project/ts/functionality/user/getBrowser.ts rename to project/user/getBrowser.ts diff --git a/project/ts/functionality/user/getDays.ts b/project/user/getDays.ts similarity index 100% rename from project/ts/functionality/user/getDays.ts rename to project/user/getDays.ts diff --git a/project/ts/functionality/user/getHours.ts b/project/user/getHours.ts similarity index 80% rename from project/ts/functionality/user/getHours.ts rename to project/user/getHours.ts index 4e811a1..ddf3cce 100644 --- a/project/ts/functionality/user/getHours.ts +++ b/project/user/getHours.ts @@ -4,9 +4,9 @@ * @param {number} age * @returns {number} */ -export default function getHours(age: number): number { + export default function getHours(age: number): number { if (typeof age !== "number") { throw new TypeError("Expected a number but got " + typeof age); } return age * 12 * 7 * 4 * 24; -} +} \ No newline at end of file diff --git a/project/user/getMinutes.ts b/project/user/getMinutes.ts new file mode 100644 index 0000000..fd87544 --- /dev/null +++ b/project/user/getMinutes.ts @@ -0,0 +1,12 @@ +/** + * returns the number of minutes in a given age + * + * @param {number} age + * @returns {number} + */ + export default function getWeeks(age: number): number { + if (typeof age !== "number") { + throw new TypeError("Expected a number but got " + typeof age); + } + return age * 12 * 7 * 4 * 24 * 60; + } \ No newline at end of file diff --git a/project/user/getMonths.ts b/project/user/getMonths.ts new file mode 100644 index 0000000..eb10390 --- /dev/null +++ b/project/user/getMonths.ts @@ -0,0 +1,12 @@ +/** + * returns the months of the age + * + * @param {number} age + * @returns {number} + */ + export default function getMonths(age: number): number { + if (typeof age !== "number") { + throw new TypeError("Expected a number but got " + typeof age); + } + return age * 12; + } \ No newline at end of file diff --git a/project/ts/functionality/user/getSeconds.ts b/project/user/getSeconds.ts similarity index 50% rename from project/ts/functionality/user/getSeconds.ts rename to project/user/getSeconds.ts index a476c4c..2c979ea 100644 --- a/project/ts/functionality/user/getSeconds.ts +++ b/project/user/getSeconds.ts @@ -5,8 +5,8 @@ * @returns {number} */ export default function getSeconds(age: number): number { - if (typeof age !== "number") { - throw new TypeError("Expected a number but got " + typeof age); - } - return age * 12 * 7 * 4 * 24 * 60 * 60; -} \ No newline at end of file + if (typeof age !== "number") { + throw new TypeError("Expected a number but got " + typeof age); + } + return age * 12 * 7 * 4 * 24 * 60 * 60; + } \ No newline at end of file diff --git a/project/ts/functionality/user/getWeeks.ts b/project/user/getWeeks.ts similarity index 79% rename from project/ts/functionality/user/getWeeks.ts rename to project/user/getWeeks.ts index 8478812..dd702bf 100644 --- a/project/ts/functionality/user/getWeeks.ts +++ b/project/user/getWeeks.ts @@ -4,9 +4,9 @@ * @param {number} age * @returns {number} */ -export default function getWeeks(age: number): number { + export default function getWeeks(age: number): number { if (typeof age !== "number") { throw new TypeError("Expected a number but got " + typeof age); } return age * 12 * 4; -} +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index b939474..7ead1ff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "files": ["project/ts/functionality/main.ts"], + "files": ["project/main.ts"], "compilerOptions": { "noImplicitAny": true, "target": "es2015", diff --git a/tsconfig.npm.json b/tsconfig.npm.json index fb11725..ee97ccb 100644 --- a/tsconfig.npm.json +++ b/tsconfig.npm.json @@ -1,7 +1,7 @@ { - "files": ["project/ts/functionality/main.ts"], + "files": ["project/main.ts"], "compilerOptions": { - "rootDir": "project/ts/functionality", + "rootDir": "project/", "noImplicitAny": true, "target": "ES2020", "module": "ES2020", @@ -10,6 +10,5 @@ "declaration": true, "declarationDir": "./lib/", "outDir": "./lib/" - } -} \ No newline at end of file +} diff --git a/vite.config.ts b/vite.config.ts index 474a428..510c113 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,19 +2,19 @@ import { defineConfig } from "vite"; export default defineConfig({ plugins: [], - root: "./project/ts/functionality", + root: "./project/", build: { - outDir: "./../../../dist", + outDir: "./dist", rollupOptions: { output: { - entryFileNames: "functionality.min.js", - } + entryFileNames: "functionality.min.js", + }, }, emptyOutDir: true, - assetsDir: "./../../../dist", + assetsDir: "./dist", watch: { buildDelay: 0, clearScreen: true, }, }, -}); \ No newline at end of file +}); From 7ce52ed3d98a9151b77e7f7af6ec74a4682a061e Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 14 Jul 2022 21:52:26 +0200 Subject: [PATCH 20/24] adding npm keywords and copy (beta) function --- package-lock.json | 8 ++++---- package.json | 8 ++++---- project/user/copy.ts | 14 ++++++-------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2eef772..2cf416b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "functionality", - "version": "1.0.0", + "name": "functionality.js", + "version": "3.2.3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "functionality", - "version": "1.0.0", + "name": "functionality.js", + "version": "3.2.3", "license": "ISC", "dependencies": { "@types/node": "^17.0.42", diff --git a/package.json b/package.json index d99d7b4..9836d0b 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "functionality.js", "entry": "index.js", - "version": "3.2.3", + "version": "3.2.4", "description": "- This Is A JavaScript Library To Make Your Work Easier/Faster,
\r You Can See Functionalty.js Website From Here\r - Born In May 5 / 16 / 2022", - "homepage": "https://github.com/Ali-Eldeba/functionalty.js#readme", + "homepage": "https://github.com/alieldeba/functionalty.js#readme", "author": "alieldeba", "main": "index.js", "keywords": [ @@ -19,11 +19,11 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Ali-Eldeba/functionalty.js.git" + "url": "git+https://github.com/alieldeba/functionalty.js.git" }, "license": "ISC", "bugs": { - "url": "https://github.com/Ali-Eldeba/functionalty.js/issues" + "url": "https://github.com/alieldeba/functionalty.js/issues" }, "devDependencies": { "jest": "^26.6.3", diff --git a/project/user/copy.ts b/project/user/copy.ts index dc6288e..7535361 100644 --- a/project/user/copy.ts +++ b/project/user/copy.ts @@ -1,10 +1,8 @@ +/** + * It takes text to copy it to the user + * + * @param {string} text - The text to copy to the clipboard. + */ export default function copy(text: string): void { - navigator.clipboard.writeText(text).then( - function () { - console.log("Async: Copying to clipboard was successful!"); - }, - function (err) { - console.error("Async: Could not copy text: ", err); - } - ); + navigator.clipboard.writeText(text); } From a03f5b994b77bf2be8ecebef8df82b770acdb395 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 14 Jul 2022 22:31:23 +0200 Subject: [PATCH 21/24] fixing bugs --- dist/functionality.min.js | 2 +- dist/index.html | 16 +++++++++++++++- lib/user/copy.d.ts | 5 +++++ lib/user/copy.js | 5 +++++ project/dist/functionality.min.js | 1 - project/dist/index.html | 24 ------------------------ project/index.html | 1 - project/main.ts | 4 ++-- project/user/copy.ts | 12 +++++++++--- vite.config.ts | 4 ++-- 10 files changed, 39 insertions(+), 35 deletions(-) delete mode 100644 project/dist/functionality.min.js delete mode 100644 project/dist/index.html diff --git a/dist/functionality.min.js b/dist/functionality.min.js index 65f1c9d..52a74c3 100644 --- a/dist/functionality.min.js +++ b/dist/functionality.min.js @@ -1 +1 @@ -const x=function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const n of o)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(o){const n={};return o.integrity&&(n.integrity=o.integrity),o.referrerpolicy&&(n.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?n.credentials="include":o.crossorigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(o){if(o.ep)return;o.ep=!0;const n=t(o);fetch(o.href,n)}};x();function u(e){if(!Array.isArray(e)||e.some(r=>typeof r!="number"))throw new TypeError("Expected an array of numbers but got "+(Array.isArray(e)?"array":typeof e));return e.reduce((r,t)=>r+t,0)}function f(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e?e.charAt(0).toUpperCase()+e.slice(1):""}function s(e,r){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e.filter(t=>t!=r)}function c(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return[...Array(e+1).keys()].filter(r=>e%r===0)}function y(e=0,r){return typeof e!="number"&&!r?0:!r&&typeof+e=="number"?e:isNaN(+e)||isNaN(+r)?0:Math.floor((+e+ +r)/2)}function d(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2==0}function h(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2!=0}function p(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);for(let r=2,t=Math.sqrt(e);r<=t;r++)if(e%r===0)return!1;return!0}function g(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.max(...e)}function m(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.min(...e)}function w(){return Math.random()>=.5}function M(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e[Math.floor(Math.random()*e.length)]}function S(){return`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`}function E(e,r){if(typeof e!="number"||typeof r!="number")throw new TypeError("Expected numbers but got "+typeof e+" and "+typeof r);return Math.floor(Math.random()*(r-e+1)+e)}function G(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);e.filter(function(r,t){return[...new Set(e)]})}function k(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return!e||typeof e!="string"?"":e.split("").reverse().join("")}function A(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);if(e==0)return 0;if(e<10&&e>-10)return e;const r=+(e>10?e:e*-1).toString().split("").reverse().join("");return e>10?r:r*-1}function B(e){if(!Array.isArray(e))throw new TypeError("Expected an array");return e.sort((r,t)=>.5-Math.random())}function L(e=5){if(typeof e!="number")throw new TypeError("Expected numbers but got "+typeof e);for(var r="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length,o=0;o0;)t+=Math.pow(e%10,2),e=Math.floor(e/10);e=t}return e===1}function P(){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()_-+={[}]|\\:;\"'<,>.?/~`!";let r="";for(let t=0;t<12;t++)r+=e[Math.floor(Math.random()*e.length)];return r}const l={sumOfArray:u,capitalize:f,filterArray:s,getFactors:c,getMid:y,isEven:d,isOdd:h,isPrime:p,isPalindrome:b,maxArray:g,minArray:m,randomBoolean:w,randomElementFrom:M,randomHex:S,randomNumber:E,removeDuplicate:G,reverseString:k,reverseNumber:A,shuffle:B,randomString:L,randomColor:D,randomHsl:v,isHappyNumber:T,randomPassword:P};window.functionality=l;function b(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.toString()==l.reverseString(e.toString())}const O={sumOfArray:u,capitalize:f,filterArray:s,getFactors:c,getMid:y,isEven:d,isOdd:h,isPrime:p,isPalindrome:b,maxArray:g,minArray:m,randomBoolean:w,randomElementFrom:M,randomHex:S,randomNumber:E,removeDuplicate:G,reverseString:k,reverseNumber:A,shuffle:B,randomString:L,randomColor:D,randomHsl:v,isHappyNumber:T,randomPassword:P};window.functionality=O;console.log(l.reverseNumber(123)); +const U=function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerpolicy&&(o.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?o.credentials="include":n.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(n){if(n.ep)return;n.ep=!0;const o=t(n);fetch(n.href,o)}};U();function l(e){if(!Array.isArray(e)||e.some(r=>typeof r!="number"))throw new TypeError("Expected an array of numbers but got "+(Array.isArray(e)?"array":typeof e));return e.reduce((r,t)=>r+t,0)}function c(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e?e.charAt(0).toUpperCase()+e.slice(1):""}function s(e,r){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e.filter(t=>t!=r)}function p(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return[...Array(e+1).keys()].filter(r=>e%r===0)}function y(e=0,r){return typeof e!="number"&&!r?0:!r&&typeof+e=="number"?e:isNaN(+e)||isNaN(+r)?0:Math.floor((+e+ +r)/2)}function h(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2==0}function d(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2!=0}function g(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);for(let r=2,t=Math.sqrt(e);r<=t;r++)if(e%r===0)return!1;return!0}function m(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.max(...e)}function w(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.min(...e)}function M(){return Math.random()>=.5}function E(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e[Math.floor(Math.random()*e.length)]}function S(){return`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`}function b(e,r){if(typeof e!="number"||typeof r!="number")throw new TypeError("Expected numbers but got "+typeof e+" and "+typeof r);return Math.floor(Math.random()*(r-e+1)+e)}function k(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);e.filter(function(r,t){return[...new Set(e)]})}function B(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return!e||typeof e!="string"?"":e.split("").reverse().join("")}function G(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);if(e==0)return 0;if(e<10&&e>-10)return e;const r=+(e>10?e:e*-1).toString().split("").reverse().join("");return e>10?r:r*-1}function T(e){return e.toString().replace(new RegExp("\\B(?.5-Math.random())}function A(e=5){if(typeof e!="number")throw new TypeError("Expected numbers but got "+typeof e);for(var r="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length,n=0;n0;)t+=Math.pow(e%10,2),e=Math.floor(e/10);e=t}return e===1}function P(){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()_-+={[}]|\\:;\"'<,>.?/~`!";let r="";for(let t=0;t<12;t++)r+=e[Math.floor(Math.random()*e.length)];return r}function C(e,r,t){return"#"+((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1)}function O(e){return e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(r,t,i,n)=>"#"+t+t+i+i+n+n).substring(1).match(/.{2}/g).map(r=>parseInt(r,16))}function R(e,r,t){e/=255,r/=255,t/=255;var i=Math.max(e,r,t),n=Math.min(e,r,t),o,a,f=(i+n)/2;if(i==n)o=a=0;else{var u=i-n;switch(a=f>.5?u/(2-i-n):u/(i+n),i){case e:o=(r-t)/u+(r(a+e/30)%12,n=r*Math.min(t,1-t),o=a=>t-n*Math.max(-1,Math.min(i(a)-3,Math.min(9-i(a),1)));return[Math.trunc(255*o(0)),Math.trunc(255*o(8)),Math.trunc(255*o(4))]}function W(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.replace(/\s+/g," ")}function q(){return navigator.userAgent.split(" ")[navigator.userAgent.split(" ").length-1]}function F(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12}function Y(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*4}function H(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*4*7}function $(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24}function I(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24*60}function V(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24*60*60}function _(e){var r=new Date,t=r.getFullYear();return t-e}function j(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return document.querySelector(e)}const K={sumOfArray:l,capitalize:c,filterArray:s,getFactors:p,getMid:y,isEven:h,isOdd:d,isPrime:g,isPalindrome:z,maxArray:m,minArray:w,randomBoolean:M,randomElementFrom:E,randomHex:S,randomNumber:b,addCommas:T,removeDuplicate:k,reverseString:B,reverseNumber:G,shuffle:v,randomString:A,randomColor:D,randomHsl:x,isHappyNumber:L,randomPassword:P,rgbToHex:C,hexToRgb:O,rgbToHsl:R,hslToRgb:N,removeInnerSpace:W,getBrowser:q,getMonths:F,getWeeks:Y,getDays:H,getHours:$,getSeconds:V,getMinutes:I,getBirthDay:_,select:j};window.functionality=K;function z(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.toString()==K.reverseString(e.toString())}function J(e){var r=new Date,t=r.getFullYear();return t-e}const Q={sumOfArray:l,capitalize:c,filterArray:s,getFactors:p,getMid:y,isEven:h,isOdd:d,isPrime:g,isPalindrome:z,maxArray:m,minArray:w,randomBoolean:M,randomElementFrom:E,randomHex:S,randomNumber:b,addCommas:T,removeDuplicate:k,reverseString:B,reverseNumber:G,shuffle:v,randomString:A,randomColor:D,randomHsl:x,isHappyNumber:L,randomPassword:P,rgbToHex:C,hexToRgb:O,rgbToHsl:R,hslToRgb:N,removeInnerSpace:W,getBrowser:q,getMonths:F,getWeeks:Y,getDays:H,getHours:$,getMinutes:I,getSeconds:V,getBirthday:J,select:j};window.functionality=Q; diff --git a/dist/index.html b/dist/index.html index 63fd6ed..19fbc02 100644 --- a/dist/index.html +++ b/dist/index.html @@ -3,8 +3,22 @@ functionality.js + + +

Thanks for contributing to functionality.js Library ❤🙏

+ + - diff --git a/lib/user/copy.d.ts b/lib/user/copy.d.ts index 002661b..48ebdf9 100644 --- a/lib/user/copy.d.ts +++ b/lib/user/copy.d.ts @@ -1 +1,6 @@ +/** + * It takes text to copy it to the user + * + * @param {string} text - The text to copy to the clipboard. + */ export default function copy(text: string): void; diff --git a/lib/user/copy.js b/lib/user/copy.js index 7a04c1f..40c16f9 100644 --- a/lib/user/copy.js +++ b/lib/user/copy.js @@ -1,3 +1,8 @@ +/** + * It takes text to copy it to the user + * + * @param {string} text - The text to copy to the clipboard. + */ export default function copy(text) { navigator.clipboard.writeText(text).then(function () { console.log("Async: Copying to clipboard was successful!"); diff --git a/project/dist/functionality.min.js b/project/dist/functionality.min.js deleted file mode 100644 index 963f0a5..0000000 --- a/project/dist/functionality.min.js +++ /dev/null @@ -1 +0,0 @@ -const U=function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerpolicy&&(o.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?o.credentials="include":n.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(n){if(n.ep)return;n.ep=!0;const o=t(n);fetch(n.href,o)}};U();function l(e){if(!Array.isArray(e)||e.some(r=>typeof r!="number"))throw new TypeError("Expected an array of numbers but got "+(Array.isArray(e)?"array":typeof e));return e.reduce((r,t)=>r+t,0)}function c(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e?e.charAt(0).toUpperCase()+e.slice(1):""}function s(e,r){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e.filter(t=>t!=r)}function p(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return[...Array(e+1).keys()].filter(r=>e%r===0)}function y(e=0,r){return typeof e!="number"&&!r?0:!r&&typeof+e=="number"?e:isNaN(+e)||isNaN(+r)?0:Math.floor((+e+ +r)/2)}function h(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2==0}function d(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e%2!=0}function g(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);for(let r=2,t=Math.sqrt(e);r<=t;r++)if(e%r===0)return!1;return!0}function m(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.max(...e)}function w(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return Math.min(...e)}function M(){return Math.random()>=.5}function E(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);return e[Math.floor(Math.random()*e.length)]}function S(){return`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`}function b(e,r){if(typeof e!="number"||typeof r!="number")throw new TypeError("Expected numbers but got "+typeof e+" and "+typeof r);return Math.floor(Math.random()*(r-e+1)+e)}function k(e){if(!Array.isArray(e))throw new TypeError("Expected an array but got "+typeof e);e.filter(function(r,t){return[...new Set(e)]})}function T(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return!e||typeof e!="string"?"":e.split("").reverse().join("")}function B(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);if(e==0)return 0;if(e<10&&e>-10)return e;const r=+(e>10?e:e*-1).toString().split("").reverse().join("");return e>10?r:r*-1}function G(e){return e.toString().replace(new RegExp("\\B(?.5-Math.random())}function v(e=5){if(typeof e!="number")throw new TypeError("Expected numbers but got "+typeof e);for(var r="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length,n=0;n0;)t+=Math.pow(e%10,2),e=Math.floor(e/10);e=t}return e===1}function P(){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()_-+={[}]|\\:;\"'<,>.?/~`!";let r="";for(let t=0;t<12;t++)r+=e[Math.floor(Math.random()*e.length)];return r}function C(e,r,t){return"#"+((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1)}function O(e){return e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(r,t,i,n)=>"#"+t+t+i+i+n+n).substring(1).match(/.{2}/g).map(r=>parseInt(r,16))}function R(e,r,t){e/=255,r/=255,t/=255;var i=Math.max(e,r,t),n=Math.min(e,r,t),o,a,f=(i+n)/2;if(i==n)o=a=0;else{var u=i-n;switch(a=f>.5?u/(2-i-n):u/(i+n),i){case e:o=(r-t)/u+(r(a+e/30)%12,n=r*Math.min(t,1-t),o=a=>t-n*Math.max(-1,Math.min(i(a)-3,Math.min(9-i(a),1)));return[Math.trunc(255*o(0)),Math.trunc(255*o(8)),Math.trunc(255*o(4))]}function W(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.replace(/\s+/g," ")}function q(){return navigator.userAgent.split(" ")[navigator.userAgent.split(" ").length-1]}function F(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12}function Y(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*4}function H(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*4*7}function $(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24}function I(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24*60}function V(e){if(typeof e!="number")throw new TypeError("Expected a number but got "+typeof e);return e*12*7*4*24*60*60}function _(e){var r=new Date,t=r.getFullYear();return t-e}function j(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return document.querySelector(e)}const K={sumOfArray:l,capitalize:c,filterArray:s,getFactors:p,getMid:y,isEven:h,isOdd:d,isPrime:g,isPalindrome:z,maxArray:m,minArray:w,randomBoolean:M,randomElementFrom:E,randomHex:S,randomNumber:b,addCommas:G,removeDuplicate:k,reverseString:T,reverseNumber:B,shuffle:A,randomString:v,randomColor:x,randomHsl:D,isHappyNumber:L,randomPassword:P,rgbToHex:C,hexToRgb:O,rgbToHsl:R,hslToRgb:N,removeInnerSpace:W,getBrowser:q,getMonths:F,getWeeks:Y,getDays:H,getHours:$,getSeconds:V,getMinutes:I,getBirthDay:_,select:j};window.functionality=K;function z(e){if(typeof e!="string")throw new TypeError("Expected a string but got "+typeof e);return e.toString()==K.reverseString(e.toString())}function J(e){var r=new Date,t=r.getFullYear();return t-e}function Q(e){navigator.clipboard.writeText(e).then(function(){console.log("Async: Copying to clipboard was successful!")},function(r){console.error("Async: Could not copy text: ",r)})}const X={sumOfArray:l,capitalize:c,filterArray:s,getFactors:p,getMid:y,isEven:h,isOdd:d,isPrime:g,isPalindrome:z,maxArray:m,minArray:w,randomBoolean:M,randomElementFrom:E,randomHex:S,randomNumber:b,addCommas:G,removeDuplicate:k,reverseString:T,reverseNumber:B,shuffle:A,randomString:v,randomColor:x,randomHsl:D,isHappyNumber:L,randomPassword:P,rgbToHex:C,hexToRgb:O,rgbToHsl:R,hslToRgb:N,removeInnerSpace:W,getBrowser:q,getMonths:F,getWeeks:Y,getDays:H,getHours:$,getMinutes:I,getSeconds:V,getBirthday:J,copy:Q,select:j};window.functionality=X; diff --git a/project/dist/index.html b/project/dist/index.html deleted file mode 100644 index 19fbc02..0000000 --- a/project/dist/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - functionality.js - - - - -

Thanks for contributing to functionality.js Library ❤🙏

- - - - diff --git a/project/index.html b/project/index.html index 86c1140..0bdc08b 100644 --- a/project/index.html +++ b/project/index.html @@ -20,7 +20,6 @@

Thanks for contributing to functionality.js Library ❤🙏

diff --git a/project/main.ts b/project/main.ts index b5a6cce..1e8fb35 100644 --- a/project/main.ts +++ b/project/main.ts @@ -38,7 +38,7 @@ import getHours from "./user/getHours"; import getMinutes from "./user/getMinutes"; import getSeconds from "./user/getSeconds"; import getBirthday from "./user/getBirthday"; -import copy from "./user/copy"; +// import copy from "./user/copy"; import select from "./dom/select"; const functionality = { @@ -80,7 +80,7 @@ const functionality = { getMinutes, getSeconds, getBirthday, - copy, + // copy, select, }; diff --git a/project/user/copy.ts b/project/user/copy.ts index 7535361..5eb60f1 100644 --- a/project/user/copy.ts +++ b/project/user/copy.ts @@ -1,8 +1,14 @@ /** * It takes text to copy it to the user * - * @param {string} text - The text to copy to the clipboard. + * @param {string} text */ -export default function copy(text: string): void { - navigator.clipboard.writeText(text); +export default async function copy(text: string) { + try { + const toCopy = text || location.href; + await navigator.clipboard.writeText(toCopy); + console.log("Text or Page URL copied"); + } catch (err) { + console.error("Failed to copy: ", err); + } } diff --git a/vite.config.ts b/vite.config.ts index 510c113..d1dc6af 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,14 +4,14 @@ export default defineConfig({ plugins: [], root: "./project/", build: { - outDir: "./dist", + outDir: "../dist", rollupOptions: { output: { entryFileNames: "functionality.min.js", }, }, emptyOutDir: true, - assetsDir: "./dist", + assetsDir: "../dist", watch: { buildDelay: 0, clearScreen: true, From 7112ea3fbe4e674b61cff2d544705ac82d5aee5b Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Thu, 14 Jul 2022 22:32:59 +0200 Subject: [PATCH 22/24] fixing bugs --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2c11b9b..54a53d7 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@

- + - +

@@ -75,7 +75,7 @@ - First Clone The Repository ```sh - git clone https://github.com/Ali-Eldeba/functionality.js.git + git clone https://github.com/alieldeba/functionality.js.git ``` - Then Install Packages (node_modules) From a2739282aae7389ce2c973a37dd3a065c1e1ca06 Mon Sep 17 00:00:00 2001 From: Ali Eldeba Date: Thu, 14 Jul 2022 23:27:44 +0200 Subject: [PATCH 23/24] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 54a53d7..af5204a 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@

- + - +

From eb5b613b3a09493fdb4441f2bed6cbfae9eb0a14 Mon Sep 17 00:00:00 2001 From: Ali Eldeba Date: Sun, 17 Jul 2022 11:41:33 +0200 Subject: [PATCH 24/24] Update select.ts --- project/dom/select.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/dom/select.ts b/project/dom/select.ts index f2ac74c..7dacd4f 100644 --- a/project/dom/select.ts +++ b/project/dom/select.ts @@ -1,5 +1,5 @@ /** - * returns the number of Seconds in a given age + * gets HTML dom element * * @param {string} element * @returns {number} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy