{"id":19354637,"url":"https://github.com/delaklo/js-tools-base","last_synced_at":"2025-04-23T08:31:51.565Z","repository":{"id":41115796,"uuid":"508296366","full_name":"delaklo/js-tools-base","owner":"delaklo","description":"A lightweight javascript tool library for various needs","archived":false,"fork":false,"pushed_at":"2024-07-04T14:29:25.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T23:37:36.672Z","etag":null,"topics":["framework","javascript","lib","library","node-js","nodejs","npm","tools","utilities","utils"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/delaklo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-28T12:47:34.000Z","updated_at":"2024-07-04T14:29:28.000Z","dependencies_parsed_at":"2022-08-29T23:10:33.349Z","dependency_job_id":null,"html_url":"https://github.com/delaklo/js-tools-base","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delaklo%2Fjs-tools-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delaklo%2Fjs-tools-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delaklo%2Fjs-tools-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delaklo%2Fjs-tools-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delaklo","download_url":"https://codeload.github.com/delaklo/js-tools-base/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250399503,"owners_count":21424194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","javascript","lib","library","node-js","nodejs","npm","tools","utilities","utils"],"created_at":"2024-11-10T05:02:53.305Z","updated_at":"2025-04-23T08:31:51.298Z","avatar_url":"https://github.com/delaklo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-tools-base\n[![NPM Version](https://img.shields.io/npm/v/js-tools-base)](https://www.npmjs.com/package/js-tools-base) \u003cbr\u003e\nA lightweight javascript tool library for various needs.\n\n## Version 1.2.0\nList of tools: isObject, isEmptyOrOnlySpacesString, getTimeZone, doesObjectHaveEmptyProps, isSorted, shuffleArray, generateRandomIntList, randomInt.\n\n## Installation\n```sh\n$ npm install js-tools-base\n```\n## Usage\n```js\nconst { ExampleTool } = require(\"js-tools-base\");\n```\n## List of tools\n\u003cb\u003eisObject(object)\u003c/b\u003e\u003cbr\u003e\n\nCheck is that object in argument of function or not.\n```js\nconsole.log(isObject({ \"id\": 123, \"message\": \"hello Iphone\" })); //true\nconsole.log(isObject('some string')); //false\n```\n\n\u003cb\u003eisEmptyOrOnlySpacesString(string)\u003c/b\u003e\u003cbr\u003e\n\nChecks is string empty or has only spaces.\n```js\nconsole.log(isEmptyOrOnlySpacesString('Apple')); //false\nconsole.log(isEmptyOrOnlySpacesString('')); //true\nconsole.log(isEmptyOrOnlySpacesString('    ')); //true\nconsole.log(isEmptyOrOnlySpacesString('Ap  p le')); //false\n```\n\n\u003cb\u003egetTimeZone()\u003c/b\u003e\u003cbr\u003e\n\nGets the requester's time zone.\n```js\nconsole.log(getTimeZone()); //europe/kiev\n```\n\n\u003cb\u003edoesObjectHaveEmptyProperties(object)\u003c/b\u003e\u003cbr\u003e\n\nchecks does object have blank properties.\n```js\nconst obj = {\n    name: \"John\",\n    dataOfBirth: \"\",\n    externalId: 2548,\n    email: \"john@email.com\",\n    mobile: \"\"\n}\n\nconst data = {\n    name: \"Sal\",\n    dataOfBirth: \"12.12.2012\",\n    externalId: 83838,\n    email: \"sal@email.com\",\n    mobile: \"122344566\"\n}\nconsole.log(doesObjectHaveEmptyProps(obj)); //dataOfBirth is empty, mobile is empty, other keys are filled\nconsole.log(doesObjectHaveEmptyProps(data)); //other keys are filled\n```\n\n\u003cb\u003eIsSorted(array)\u003c/b\u003e\u003cbr\u003e\n\nChecks is sorted array in argument of function or not.\n```js\nconsole.log(isSorted([1,3,4,9,13])); //true\nconsole.log(isSorted([5, 7, 1, 67])); //false\n```\n\n\u003cb\u003eshuffleArray(array)\u003c/b\u003e\u003cbr\u003e\n\nShuffles the values of an array, returning a new array.\n```js\nlet arr = [4, 6, 7, 9];\nconsole.log(shuffleArray(arr)); //[7, 4, 9, 6]\n```\n\n\u003cb\u003egenerateRandomIntList(length, max)\u003c/b\u003e\u003cbr\u003e\n\nGenerates an array with random int values. First argument is the length of array, second is the max possible integer.\n```js\nconsole.log(generateRandomIntList(8, 100)); //[ 41, 4, 52, 9, 82, 50, 19, 60 ]\nconsole.log(generateRandomIntList(5, 5)); //[ 1, 0, 2, 0, 4 ]\n```\n\n\u003cb\u003erandomInt(min, max)\u003c/b\u003e\u003cbr\u003e\n\nGenerates an integer between the minimum given value and the maximum given value.\n```js\nconsole.log(randomInt(3, 576)); // 207\nconsole.log(randomInt(50, 60)); // 58\n```\n\n\u003cb\u003ecapitalizeFirstLetter(string)\u003c/b\u003e\u003cbr\u003e\n\nCapitalizes the first letter of a string.\n```js\nconsole.log(capitalizeFirstLetter('hello')); // Hello\nconsole.log(capitalizeFirstLetter('')); // ''\n```\n\n\u003cb\u003edebounce(func, wait)\u003c/b\u003e\u003cbr\u003e\nDebounces a function to limit its execution rate.\n```js\nconst log = debounce(() =\u003e console.log('Debounced!'), 1000);\nlog();\nlog();\nlog(); // Only this call will log 'Debounced!' after 1 second\n```\n\n\u003cb\u003egetQueryParams(url)\u003c/b\u003e\u003cbr\u003e\nParses URL query parameters into an object.\n\n```js\nconsole.log(getQueryParams('https://example.com?page=1\u0026sort=asc')); // { page: '1', sort: 'asc' }\n```\n\n\u003cb\u003eflattenArray(arr)\u003c/b\u003e\u003cbr\u003e\nFlattens a nested array.\n\n```js\nconsole.log(flattenArray([1, [2, [3, [4]], 5]])); // [1, 2, 3, 4, 5]\n```\n\n## Follow me and my email to cooperate\n\n[Twitter](https://twitter.com/delaklo)\n\ndelaklovp@gmail.com\n\n\u003cb\u003eat least if one of the tools you like, please star the repo. if you have free time feel free to contribute to this library\u003c/b\u003e\n\n## To do\n\nadd to do\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelaklo%2Fjs-tools-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelaklo%2Fjs-tools-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelaklo%2Fjs-tools-base/lists"}