From 79bf9d0789e68e6359779d083ad51f70c9db1ae2 Mon Sep 17 00:00:00 2001 From: Ali-Eldeba Date: Fri, 24 Jun 2022 12:07:36 +0200 Subject: [PATCH 01/11] 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 02/11] 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 03/11] 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 04/11] 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 05/11] 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 06/11] 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 07/11] 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 08/11] 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 09/11] 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 10/11] 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 11/11] 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