{"id":23073601,"url":"https://github.com/rrainn/scriptutils","last_synced_at":"2026-04-19T07:35:31.294Z","repository":{"id":90539420,"uuid":"110298787","full_name":"rrainn/scriptutils","owner":"rrainn","description":"📦 JavaScript Package - Utilities to make JavaScript Easy","archived":false,"fork":false,"pushed_at":"2019-02-08T00:09:55.000Z","size":496,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-19T17:33:48.725Z","etag":null,"topics":["browser","insert","javascript","npm-package","promise","scriptutils","utilities"],"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/rrainn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-10T22:32:01.000Z","updated_at":"2023-04-11T15:21:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"331b1aad-146b-43eb-a60e-c37d5f3e7bde","html_url":"https://github.com/rrainn/scriptutils","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/rrainn/scriptutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrainn%2Fscriptutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrainn%2Fscriptutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrainn%2Fscriptutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrainn%2Fscriptutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrainn","download_url":"https://codeload.github.com/rrainn/scriptutils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrainn%2Fscriptutils/sbom","scorecard":{"id":786539,"data":{"date":"2025-08-11","repo":{"name":"github.com/rrainn/scriptutils","commit":"7cf4e48d9f4ab2afafe6ba514b454f319b73ced3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"91 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-hc9w-4p87-j549","Warn: Project is vulnerable to: GHSA-wg6g-ppvx-927h","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-897m-rjf5-jp39","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rq8g-5pc5-wrhr","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T06:15:21.172Z","repository_id":90539420,"created_at":"2025-08-23T06:15:21.172Z","updated_at":"2025-08-23T06:15:21.172Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31999169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["browser","insert","javascript","npm-package","promise","scriptutils","utilities"],"created_at":"2024-12-16T08:18:32.378Z","updated_at":"2026-04-19T07:35:31.275Z","avatar_url":"https://github.com/rrainn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scriptutils [![Build Status](https://travis-ci.org/rrainn/scriptutils.svg?branch=master)](https://travis-ci.org/rrainn/scriptutils) [![Coverage Status](https://coveralls.io/repos/github/rrainn/scriptutils/badge.svg?branch=master)](https://coveralls.io/github/rrainn/scriptutils?branch=master) [![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=ZCt5dzFZV1Vvd0ZTUXR6dEtkTy9XOEZNdmNQOC9WN2VOcWNxR3Q5d09qMD0tLXhrUWNLdEJDMTNEYzFGV3d5dDlIUFE9PQ==--72fdff953eba74306eb1bdbb0a9729cb5c4ab122)](https://www.browserstack.com/automate/public-build/ZCt5dzFZV1Vvd0ZTUXR6dEtkTy9XOEZNdmNQOC9WN2VOcWNxR3Q5d09qMD0tLXhrUWNLdEJDMTNEYzFGV3d5dDlIUFE9PQ==--72fdff953eba74306eb1bdbb0a9729cb5c4ab122) [![Known Vulnerabilities](https://snyk.io/test/github/rrainn/scriptutils/badge.svg)](https://snyk.io/test/github/rrainn/scriptutils) [![Dependencies](https://david-dm.org/rrainn/scriptutils.svg)](https://david-dm.org/rrainn/scriptutils) [![Dev Dependencies](https://david-dm.org/rrainn/scriptutils/dev-status.svg)](https://david-dm.org/rrainn/scriptutils?type=dev) [![NPM version](https://badge.fury.io/js/scriptutils.svg)](http://badge.fury.io/js/scriptutils) [![unpkg](https://img.shields.io/badge/browser-unpkg-brightgreen.svg)](https://unpkg.com/scriptutils)\n\n### Install\n\n#### Node.js\n\n`npm install --save scriptutils`\n\n`var scriptutils = require('scriptutils');`\n\n#### Browser\n\n`\u003cscript src=\"https://unpkg.com/scriptutils\"\u003e\u003c/script\u003e` (will run latest version)\n\n`\u003cscript src=\"https://unpkg.com/scriptutils@X.Y.Z/dist/browser/index.js\"\u003e\u003c/script\u003e` (will run specific version, replace `X.Y.Z` with version you wish to run)\n\nIn browser mode it automatically creates a variable in the global scope called `scriptutils`. All examples will work on browser and Node.js.\n\n### Arrays\n\n#### Array.insert(index, items)\n\nThis function will insert item(s) into an array at the index you specify. `index` will be the new index of the item(s) you wish to insert. `items` can refer to an object or array of objects. If `index` is less than 1 it will insert the item(s) at the beginning of the array. If `index` is greater than or equal to the last index of the array the item(s) will be inserted at the end of the array.\n\n```\nvar myArray = [\"Hello\", \"World\"];\nmyArray = myArray.insert(1, \"My\");\nconsole.log(myArray); // [\"Hello\", \"My\", \"World\"]\n```\n\n```\nvar myArray = [\"Hello\", \"World\"];\nmyArray = myArray.insert(1, [\"My\", \"Amazing\"]);\nconsole.log(myArray); // [\"Hello\", \"My\", \"Amazing\", \"World\"]\n```\n\n#### Array.remove(index, [index, index, ...])\n\nThis function will remove the item at the corresponding index. `index` corresponds to a number. If multiple parameters are passed in all indexes will be deleted. If `index` is less than 1 it will insert the item(s) at the beginning of the array. If `index` is greater than or equal to the last index of the array the item(s) will be inserted at the end of the array.\n\n```\nvar myArray = [\"Hello\", \"World\"];\nmyArray = myArray.remove(1);\nconsole.log(myArray); // [\"Hello\"]\n```\n\n```\nvar myArray = [\"Hello\", \"World\"];\nmyArray = myArray.remove(1, 2);\nconsole.log(myArray); // []\n```\n\n#### Array.shuffle()\n\nThis function will shuffle the array. This function has the potential to have different outputs every time it is run.\n\n```\nvar myArray = [\"Hello\", \"World\"];\nmyArray = myArray.shuffle();\nconsole.log(myArray); // [\"World\", \"Hello\"]\n```\n\n#### Array.randomElement()\n\nThis function will return a random element in the given array. This function has the potential to have different outputs every time it is run.\n\n```\nvar myArray = [\"Hello\", \"World\"];\nconsole.log(myArray.randomElement()); // \"World\"\n```\n\n#### Array.swap(firstIndex, secondIndex)\n\nThis function will swap item(s) into an array at the indexes you specify. `firstIndex` and `secondIndex` reference the two items indexes that will be swapped in the array. If `firstIndex` or `secondIndex` don't exist in the array the array won't be changed.\n\n```\nvar myArray = [\"Hello\", \"World\"];\nmyArray = myArray.swap(0, 1);\nconsole.log(myArray); // [\"World\", \"Hello\"]\n```\n\n#### Array.max()\n\nThis function will return the largest number in an array. If no numbers exist in array NaN will be returned.\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.max()); // 5\n```\n\n#### Array.min()\n\nThis function will return the smallest number in an array. If no numbers exist in array NaN will be returned.\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.min()); // 1\n```\n\n#### Array.first()\n\nThis function will return the first element in an array. If array is empty undefined will be returned.\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.first()); // 1\n```\n\n#### Array.last()\n\nThis function will return the last element in an array. If array is empty undefined will be returned.\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.last()); // 5\n```\n\n#### Array.frontPad(item, length)\n\nThis function will return a new array with padding to the length specified. If length specified is less than array length the same array will be returned.\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.frontPad(\"item\", 8)); // [\"item\", \"item\", \"item\", 1, 2, 3, 4, 5]\n```\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.frontPad(\"item\", 3)); // [1, 2, 3, 4, 5]\n```\n\n#### Array.backPad(item, length)\n\nThis function will return a new array with padding to the length specified. If length specified is less than array length the same array will be returned.\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.backPad(\"item\", 8)); // [1, 2, 3, 4, 5, \"item\", \"item\", \"item\"]\n```\n\n```\nvar myArray = [1, 2, 3, 4, 5];\nconsole.log(myArray.backPad(\"item\", 3)); // [1, 2, 3, 4, 5]\n```\n\n\n### Numbers\n\n#### randomInt([min, max])\n\nThis function will return a random integer based on the minimum and maximum values passed in. If no minimum or maximum values are passed in the function will output a random number between 1 and 100. This function has the potential to have different outputs every time it is run.\n\n```\nvar randomNumber = scriptutils.randomInt(5, 50);\nconsole.log(randomNumber); // a random number between 5 and 50\n```\n\n```\nvar randomNumber = scriptutils.randomInt();\nconsole.log(randomNumber); // a random number between 1 and 100\n```\n\n#### randomFloat([min, max])\n\nThis function will return a random float based on the minimum and maximum values passed in. If no minimum or maximum values are passed in the function will output a random number between 1 and 100. This function has the potential to have different outputs every time it is run.\n\n```\nvar randomNumber = scriptutils.randomFloat(5, 50);\nconsole.log(randomNumber); // a random number (float) between 5 and 50\n```\n\n```\nvar randomNumber = scriptutils.randomFloat();\nconsole.log(randomNumber); // a random number (float) between 1 and 100\n```\n\n#### Number.isInt()\n\nThis function will return a boolean depending on if the number is an integer.\n\n```\nvar randomNumber = 5;\nconsole.log(randomNumber.isInt()); // true\n```\n\n```\nvar randomNumber = 1.25;\nconsole.log(randomNumber.isInt()); // false\n```\n\n\n#### Number.isFloat()\n\nThis function will return a boolean depending on if the number is an float.\n\n```\nvar randomNumber = 5;\nconsole.log(randomNumber.isFloat()); // false\n```\n\n```\nvar randomNumber = 1.25;\nconsole.log(randomNumber.isFloat()); // true\n```\n\n\n### Hash\n\n#### hashFolder(folderpath)\n\nThis function will return a hash of the files in the folder you pass in. **This function is only available in the Node.js version of scriptutils**.\n\n```\nvar folderHash = scriptutils.hashFolder(\"/\");\nconsole.log(folderHash); // folder hash of files in \"/\" directory\n```\n\n\n### String\n\n#### String.removeAfter(character)\n\nThis function will return a new string removing the character you pass in and everything after. *Unlike other scriptutils functions this function will not mutate the original string.*\n\n```\nvar myString = \"Hello World\";\nmyString = myString.removeAfter(\" \");\nconsole.log(myString); // \"Hello\"\n```\n\n#### String.removeBefore(character)\n\nThis function will return a new string removing the character you pass in and everything before. *Unlike other scriptutils functions this function will not mutate the original string.*\n\n```\nvar myString = \"Hello World\";\nmyString = myString.removeBefore(\" \");\nconsole.log(myString); // \"World\"\n```\n\n\n### Promise\n\n#### Promise.state()\n\nThis function will return a new promise that will resolve with one of three options, \"pending\", \"fulfilled\", or \"rejected\". **This function is only available in the Node.js version of scriptutils**.\n\n```\nvar myPromise = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\tresolve(\"OK\");\n\t}, 1000);\n});\nmyPromise.state().then(function (state) {\n\tconsole.log(state); // \"pending\"\n});\n```\n\n```\nvar myPromise = new Promise(function (resolve, reject) {\n\tresolve(\"OK\");\n});\nmyPromise.state().then(function (state) {\n\tconsole.log(state); // \"fulfilled\"\n});\n```\n\n```\nvar myPromise = new Promise(function (resolve, reject) {\n\treject(\"Fail\");\n});\nmyPromise.state().then(function (state) {\n\tconsole.log(state); // \"rejected\"\n});\n```\n\n#### Promise.reflect(promises)\n\nThis function will return a new promise that will resolve when all promises passed into array `promises` are settled (fulfilled or rejected). The `value` passed into the `Promise.then()` function will be an array of objects containing the status of the promise (fulfilled or rejected) and the `value` the promise itself settled with. If the promise settled with an rejection, the `e` property will hold the value passed by that rejection. Similarly, if the promise settled with a fulfillment, the `v` property will hold the value passed by that fulfillment. **This function is only available in the Node.js version of scriptutils**.\n\n```\nvar myPromise = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\tresolve(\"OK\");\n\t}, 1000);\n});\nvar myPromiseB = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\tresolve(\"OK\");\n\t}, 1000);\n});\nPromise.reflect([myPromise, myPromiseB]).then(function (state) {\n\t// At this point both myPromise and myPromiseB have been settled\n\tconsole.log(state); // [{v:\"OK\", status:\"fulfilled\"}, {v:\"OK\", status:\"fulfilled\"}]\n});\n```\n\n```\nvar myPromise = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\tresolve(\"OK\");\n\t}, 1000);\n});\nvar myPromiseB = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\treject(\"Fail\");\n\t}, 1000);\n});\nPromise.reflect([myPromise, myPromiseB]).then(function (state) {\n\t// At this point both myPromise and myPromiseB have been settled\n\tconsole.log(state); // [{v:\"OK\", status:\"fulfilled\"}, {e:\"Fail\", status:\"rejected\"}]\n});\n```\n\n```\nvar myPromise = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\tresolve(\"OK\");\n\t}, 1000);\n});\nvar myPromiseB = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\treject(\"Fail\");\n\t}, 1000);\n});\nvar myPromiseC = new Promise(function (resolve, reject) {\n\tsetTimeout(function() {\n\t\tresolve(\"OK\");\n\t}, 1000);\n});\nPromise.reflect([myPromise, myPromiseB, myPromiseC]).then(function (state) {\n\t// At this point both myPromise, myPromiseB, and myPromiseC have been settled\n\t// Unlike Promise.all, this function won't resolve after the first rejection but will only resolve after ALL promises have been settled\n\tconsole.log(state); // [{v:\"OK\", status:\"fulfilled\"}, {e:\"Fail\", status:\"rejected\"}, {v:\"OK\", status:\"fulfilled\"}]\n});\n```\n\n### Timeout\n\n#### scriptutils.timeout(ms)\n\nThis function will return a promise that will resolve after the number of milliseconds passed in. The promise will reject if an invalid number of milliseconds are passed in. **This function is only available in the Node.js version of scriptutils**.\n\n```\nscriptutils.timeout(1000).then(function() {\n\tconsole.log(\"This will be run after 1 second\");\n});\n```\n\n```\nscriptutils.timeout(\"test\").catch(function() {\n\tconsole.log(\"This will be run because the number of milliseconds is invalid\");\n});\n```\n\n### Mutation\n\nAll functions in scriptutils are non-mutating. You must set your variable to the new variable that is returned.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrainn%2Fscriptutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrainn%2Fscriptutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrainn%2Fscriptutils/lists"}