{"id":19324375,"url":"https://github.com/ganeshrvel/npm-nice-utils","last_synced_at":"2026-04-28T16:02:46.083Z","repository":{"id":65459170,"uuid":"169237978","full_name":"ganeshrvel/npm-nice-utils","owner":"ganeshrvel","description":"A collection of useful utilities for the browser and node.js environments.","archived":false,"fork":false,"pushed_at":"2019-02-07T18:01:21.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T08:39:04.885Z","etag":null,"topics":["electron","es6","javascript","node","nodejs","npm","utilities","utils"],"latest_commit_sha":null,"homepage":"https://github.com/ganeshrvel/npm-nice-utils","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/ganeshrvel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-05T12:32:07.000Z","updated_at":"2020-02-13T17:45:30.000Z","dependencies_parsed_at":"2023-01-24T13:55:12.310Z","dependency_job_id":null,"html_url":"https://github.com/ganeshrvel/npm-nice-utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-nice-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-nice-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-nice-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-nice-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ganeshrvel","download_url":"https://codeload.github.com/ganeshrvel/npm-nice-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240427266,"owners_count":19799470,"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":["electron","es6","javascript","node","nodejs","npm","utilities","utils"],"created_at":"2024-11-10T02:04:55.530Z","updated_at":"2026-04-28T16:02:41.028Z","avatar_url":"https://github.com/ganeshrvel.png","language":"JavaScript","funding_links":["https://paypal.me/ganeshrvel"],"categories":[],"sub_categories":[],"readme":"# npm: nice-utils\n\n- Author: [Ganesh Rathinavel](https://www.linkedin.com/in/ganeshrvel \"Ganesh Rathinavel\")\n- License: [MIT](https://github.com/ganeshrvel/openmtp/blob/master/LICENSE \"MIT\")\n- Website URL: [https://github.com/ganeshrvel/npm-nice-utils](https://github.com/ganeshrvel/npm-nice-utils/ \"https://github.com/ganeshrvel/npm-nice-utils\")\n- Repo URL: [https://github.com/ganeshrvel/npm-nice-utils](https://github.com/ganeshrvel/npm-nice-utils/ \"https://github.com/ganeshrvel/npm-nice-utils\")\n- Contacts: ganeshrvel@outlook.com\n\n### Introduction\n\n##### A collection of useful utilities for the browser and node.js environments.\n\n## Installation\n\n```shell\n$ npm install nice-utils\n\nor \n\n$ yarn add nice-utils\n```\n\n## Usage\n```javascript\n// Import ES6 way\n\nimport {\n  arrayIntersection,\n  changeURLHash,\n  htmlSanitize,\n  isArray,\n  isArrayEqual,\n  isElementLoaded,\n  isFloat,\n  isFunction,\n  isImageLoaded,\n  isInt,\n  isIos,\n  isJson,\n  isNumber,\n  isObject,\n  isString,\n  isTouchDevice,\n  netElementWidth,\n  niceBytes,\n  onlyNumbers,\n  percentage,\n  quickHash,\n  randomNumber,\n  replaceAll,\n  replaceBulk,\n  rtrim,\n  splitIntoLines,\n  springTruncate,\n  stripTags,\n  toObject,\n  truncate,\n  undefinedOrNull,\n  undefinedOrNullChained,\n  urlSanitize,\n  urls\n} from 'nice-utils';\n\n// Import ES2015 way\nconst niceUtils = require('nice-utils')\t\n```\n\n## Methods Overview\n\n- arrayIntersection - Intersect common elements of two arrays\n\n```javascript\narrayIntersection([1], [1, 2]);\n\n//output: [1]\n```\n\n- isArray - Checks whether the input is an Array\n\n```javascript\nisArray([1]);\n\n//output: true\n```\n\n- isArrayEqual - Checks whether the inputted arrays are equal\n\n```javascript\nisArrayEqual([1], [1]);\n\n//output: true\n```\n\n- isElementLoaded - Wait for a DOM element to load\n\n```javascript\n//Example:\nisElementLoaded(\n  '#id', //selector\n  200 //timeout (optional)\n).\nthen(response =\u003e {\n  console.log(`The element was successfully loaded into the DOM`);\n}).\ncatch(e =\u003e {\n  console.error(e);\n});\n```\n\n\n- isImageLoaded - Wait for an image to load.\n\n```javascript\nisImageLoaded(\n    'https://sample-videos.com/img/Sample-jpg-image-500kb.jpg').\nthen(res =\u003e {\n  console.log(`Success`);\n  \n  const img = document.createElement('img');\n  img.src = res.src;\n  parentSelector.appendChild(img);\n}).\ncatch(e =\u003e {\n  console.error(`Error`);\n});\n```\n\n##### Rest of the documentation shall be updated very soon. In the mean time please find the methods and usage information from [src/index.js](https://github.com/ganeshrvel/npm-nice-utils/blob/master/src/index.js \"src/index.js\")\n\n\n## Building from Source\n\nRequirements: [Node.js v6+](https://nodejs.org/en/download/ \"Install Node.js\"), [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git \"Install Git\") and [npm](https://www.npmjs.com/get-npm \"Install Node package manager\")\n\n\n### Clone\n```shell\n$ git clone --depth 1 --single-branch --branch master https://github.com/ganeshrvel/npm-nice-utils.git\n\n$ cd npm-nice-utils\n```\n\n### Contribute\n- Fork the repo and create your branch from master.\n- Ensure that the changes pass linting.\n- Update the documentation if needed.\n- Make sure your code lints.\n- Issue a pull request!\n\nWhen you submit code changes, your submissions are understood to be under the same [MIT License](https://github.com/ganeshrvel/npm-nice-utils/blob/master/LICENSE \"MIT License\") that covers the project. Feel free to contact the maintainers if that's a concern.\n\n\n### Buy me a coffee\nHelp me keep the app FREE and open for all.\nPaypal me: [paypal.me/ganeshrvel](https://paypal.me/ganeshrvel \"paypal.me/ganeshrvel\")\n\n### Contacts\nPlease feel free to contact me at ganeshrvel@outlook.com\n\n### More repos\n- [Electron React Redux Advanced Boilerplate](https://github.com/ganeshrvel/electron-react-redux-advanced-boilerplate \"Electron React Redux Advanced Boilerplate\")\n- [OpenMTP  - Advanced Android File Transfer Application for macOS](https://github.com/ganeshrvel/openmtp \"OpenMTP  - Advanced Android File Transfer Application for macOS\")\n- [Tutorial Series by Ganesh Rathinavel](https://github.com/ganeshrvel/tutorial-series-ganesh-rathinavel \"Tutorial Series by Ganesh Rathinavel\")\n\n### License\nnice-utils | A collection of useful utilities for the browser and node.js environments is released under [MIT License](https://github.com/ganeshrvel/npm-nice-utils/blob/master/LICENSE \"MIT License\").\n\nCopyright © 2018-Present Ganesh Rathinavel\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshrvel%2Fnpm-nice-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganeshrvel%2Fnpm-nice-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshrvel%2Fnpm-nice-utils/lists"}