{"id":14976533,"url":"https://github.com/ship-components/ship-components-utility","last_synced_at":"2026-01-18T08:33:43.334Z","repository":{"id":18261986,"uuid":"83494560","full_name":"ship-components/ship-components-utility","owner":"ship-components","description":"Javascript set of utilities","archived":false,"fork":false,"pushed_at":"2023-01-11T11:53:14.000Z","size":3912,"stargazers_count":1,"open_issues_count":29,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-09-07T20:45:40.271Z","etag":null,"topics":["babel","babel-plugin","es6","es6-javascript","grunt","grunt-plugins","javascript","javascript-library","utilities","utility-library","webpack","webpack2"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ship-components-utility","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/ship-components.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":"2017-03-01T00:50:10.000Z","updated_at":"2020-11-13T19:22:34.000Z","dependencies_parsed_at":"2023-01-13T19:44:49.793Z","dependency_job_id":null,"html_url":"https://github.com/ship-components/ship-components-utility","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/ship-components/ship-components-utility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-utility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-utility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-utility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-utility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ship-components","download_url":"https://codeload.github.com/ship-components/ship-components-utility/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-utility/sbom","scorecard":{"id":819390,"data":{"date":"2025-08-11","repo":{"name":"github.com/ship-components/ship-components-utility","commit":"d37de9d916fa21921d6814c097eed8353a2d1545"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"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":"Code-Review","score":2,"reason":"Found 2/8 approved changesets -- score normalized to 2","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":"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":"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":"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":"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":"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 29 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":"89 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","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-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","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-3gx7-xhv7-5mx3","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-957j-59c2-j692","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-m5pj-vjjf-4m3h","Warn: Project is vulnerable to: GHSA-j383-35pm-c5h4","Warn: Project is vulnerable to: GHSA-rm36-94g8-835r","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-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","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-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","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-952p-6rrq-rcjv","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-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-6fw4-hr69-g3rv","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-3f95-r44v-8mrg","Warn: Project is vulnerable to: GHSA-28xr-mwxg-3qc8","Warn: Project is vulnerable to: GHSA-9p95-fxvg-qgq2","Warn: Project is vulnerable to: GHSA-9w5j-4mwv-2wj8","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","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-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","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-23T15:00:22.844Z","repository_id":18261986,"created_at":"2025-08-23T15:00:22.844Z","updated_at":"2025-08-23T15:00:22.844Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":["babel","babel-plugin","es6","es6-javascript","grunt","grunt-plugins","javascript","javascript-library","utilities","utility-library","webpack","webpack2"],"created_at":"2024-09-24T13:54:02.193Z","updated_at":"2026-01-18T08:33:43.311Z","avatar_url":"https://github.com/ship-components.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ship-components-utility\n\n[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) set of utilities. Exports a commonjs module that can be used with [webpack](http://webpack.github.io/). Source is in ES6 and an ES5 version is available using [Babel](https://babeljs.io/).\n\n[![npm](https://img.shields.io/npm/v/ship-components-utility.svg)](https://www.npmjs.com/package/ship-components-utility)\n[![Build Status](http://img.shields.io/travis/ship-components/ship-components-utility/master.svg?style=flat)](https://travis-ci.org/ship-components/ship-components-utility)\n[![Coverage](http://img.shields.io/coveralls/ship-components/ship-components-utility.svg?style=flat)](https://coveralls.io/github/ship-components/ship-components-utility)\n[![devDependencies](https://img.shields.io/david/dev/ship-components/ship-components-utility.svg?style=flat)](https://david-dm.org/ship-components/ship-components-utility?type=dev)\n[![Greenkeeper badge](https://badges.greenkeeper.io/ship-components/ship-components-utility.svg)](https://greenkeeper.io/)\n\n## Docs \u0026 Help\n\n* [Usage](#usage)\n* [Development](#development)\n* [Webpack Configuration](#webpack-configuration)\n* [Tests](#tests)\n* [History](#history)\n\nHere is the list of utilities you can use.\n\n* [Collections](#collections)\n  * [keys](#keys)\n  * [toArray](#toarray)\n  * [each](#each)\n  * [size](#size)\n  * [searchFn](#searchfn)\n  * [any](#any)\n  * [find](#find)\n  * [findIndex](#findindex)\n  * [getIn](#getin)\n  * [hasIn](#hasin)\n  * [isEqual](#isequal)\n* [KeyEvents](#keyevents)\n* [NativeFileUploadDialog](#nativefileuploaddialog)\n* [ParseUrl](#parseurl)\n* [Sort](#sort)\n  * [compareDates](#comparedates)\n  * [sortBy](#sortby)\n  * [sortByDates](#sortbydates)\n* [Strings](\n  isEqual(Object1, Object2);#strings)\nisEqual(Object1, Object2);\n  * [hash](#hash)\n  * [slugify](#slugify)\n  * [capitalize](#capitalize)\n  * [titleCase](#titlecase)\n  * [camelCase](#camelcase)\n  * [toUnderscoreCase](#tounderscorecase)\n  * [generateRandomString](#generaterandomstring)\n  * [stringShortener](#stringshortener)\n  * [stringIsValid](#stringisvalid)\n  * [convertHTMLToString](#converthtmltostring)\n* [Utils](#utils)\n  * [objectSize](#objectsize)\n  * [isObject](#isobject)\n  * [isFunction](#isfunction)\n  * [isString](#isstring)\n  * [isArray](#isarray)\n  * [isEqualArray](#isequalarray)\n  * [isUndefined](#isundefined)\n  * [bind](#bind)\n  * [bindAll](#bindall)\n  * [unique](#unique)\n  * [mergeDeep](#mergedeep)\n  * [deepCopy](#deepcopy)\n  * [pluck](#pluck)\n  * [isIEBrowser](#isiebrowser)\n  * [detectIEVersion](#detectieversion)\n\n\n## Usage\n\n### ES6 (Recommended)\nThe component is written using ES6 therefore Babel is recommended to use it. The below example is based on using [webpack](http://webpack.github.io/) and [babel-loader](https://github.com/babel/babel-loader).\n```js\n\u003c!-- import everything --\u003e\nimport * as Utility from 'ship-components-utility';\n\n\u003c!-- import specific library --\u003e\nimport {Strings, Sort, Utils, Collections} from 'ship-components-utility';\n\n\u003c!-- import specific method from a library --\u003e\nimport {capitalize, titleCase, toUnderscoreCase, generateRandomString} from 'ship-components-utility'.Strings;\n```\n\n## Docs\n### Collections\n```js\nconst {Collections} = require('ship-components-utility');\n```\n\n#### keys\n```js\n/**\n * Returns the Objects keys\n * @param  {Object} obj\n * @return {Array}  result\n */\nconst {keys} = require('ship-components-utility').Collections;\nlet obj = { name: 'test' }\nexpect(keys(obj)[0]).toEqual('name');\n```\n\n#### toArray\n```js\n/**\n * Converts an Object to an Array\n * @param  {Object} val\n * @return {Array}  result\n */\n```\n\n#### each\n```js\n/**\n * Iterate through each Object keys\n * And binds a callback to each keys\n * @param  {Object} val\n * @param  {func}   fn\n */\nconst {each} = require('ship-components-utility').Collections;\nlet obj = { name: 'test' };\nlet fn = function() {}\neach(obj, fn);\n```\n\n#### size\n```js\n/**\n * Returns the size of an object or array\n * @param  {Object || Array} val\n * @return {Number}\n */\n```\n\n#### searchFn\n```js\n/**\n * Returns the function if available inside an object\n * @param  {Object || Array || Func} val\n * @return {mixed}\n */\n```\n\n#### any\n```js\n/**\n * Similar to Javscript .some() function\n * @param  {Object || Array}  values\n * @param  {Func}             compare\n * @return {Bool}\n */\n```\n\n#### find\n```js\n/**\n * Similar to  Underscore _.find() function\n * @param  {Array}  arr\n * @param  {Func}   compare\n * @param  {Mixed}  ctx (default value) optional\n * @return {Mixed}\n */\n```\n\n#### findIndex\n```js\n/**\n * Returns the index of an item in array if exisits, -1 otherwise\n * @param  {Array}  arr\n * @param  {Func}   compare\n * @param  {Mixed}  ctx (default value) optional\n * @return {Number} -1 if can't find it\n */\n```\n\n#### getIn\n```js\n/**\n * Get a nested value of an object or return\n * @param  {Array\u003cString\u003e}  path\n * @param  {Object}         obj\n * @param  {Mixed}          defaultValue\n * @return {Mixed}\n */\nconst {getIn} = require('ship-components-utility').Collections;\nconst testMap = {\n  obj1: {\n    name: 'test1',\n    obj2: {\n      name: 'test2',\n    }\n  }\n};\ngetIn(['obj1', 'obj2', 'name'], testMap); // test2\n```\n\n#### hasIn\n```js\n/**\n * Returns true if an object has the matched value,\n * otherwise false\n * @param  {Object}         obj\n * @param  {Array\u003cString\u003e}  path\n * @return {Mixed}\n */\nconst {hasIn} = require('ship-components-utility').Collections;\nconst testMap = {\n  obj1: {\n    name: 'test1',\n    obj2: {\n      name: 'test2',\n    }\n  }\n};\nhasIn(['obj1', 'obj2', 'name'], testMap); // true\n```\n\n#### isEqual\n```js\n/**\n * First compres the size of two objects and then does a shallow\n * comparison of the two objects values\n * @param  {Mixed} one\n * @param  {Mixed} two\n * @return {Boolean}\n */\n isEqual(Object1, Object2);\n```\n\n### KeyEvents\n```js\n/**\n * List of key events\n * @param  {String} prop.Collections\n * @return {Number}\n */\nconst {KeyEvents} = require('ship-components-utility');\nKeyEvents('DOM_VK_PAGE_DOWN'); // 34\nKeyEvents('DOM_VK_ESCAPE');    // 27\n```\n\n### NativeFileUploadDialog\n```js\n/**\n * File upload dialog\n * @constructor param {String} type\n */\nconst {NativeFileUploadDialog} = require('ship-components-utility');\nnew NativeFileUploadDialog('image/*')\n  .open\n  .thenWith(callback_function)\n```\n\n### ParseUrl\n```js\n/**\n * Breaks a URL into parts\n * @param {String} url\n */\nconst {ParseUrl} = require('ship-components-utility');\nlet url = 'http://www.sony.com/homepage?param1=something\u0026param2=somethingelse';\nParseUrl(url);\n\u003c!--\nreturn value\n{\n  protocol: 'http'\n  hostname: 'www.sony.com'\n  query: 'param1=something\u0026param2=somethingelse'\n  path: '/homepage'\n}\n--\u003e\n```\n\n### Sort\n```js\nconst {Sort} = require('ship-components-utility');\n```\n\n#### compareDates\n```js\n/**\n * Compare two dates\n *\n * @param     {Date}    a\n * @param     {Date}    b\n * @return    {Number}\n */\nconst {compareDates} = require('ship-components-utility').Sort;\n```\n\n#### sortBy\n```js\n/**\n * Create a sorting function to sort an array of objects by prop. We accept any\n * number of arguments to sort by\n *\n * @param     {String...}    prop\n * @return    {Function}\n */\nconst {sortBy} = require('ship-components-utility').Sort;\n```\n\n#### sortByDates\n```js\n/**\n * Create a sorting function to sort an array of objects by prop. We accept any\n * number of arguments to sort by\n *\n * @param     {String...}    prop\n * @return    {Function}\n */\nconst {sortByDates} = require('ship-components-utility').Sort;\n```\n\n### Strings\n```js\nconst {Strings} = require('ship-components-utility');\n```\n\n#### hash\n```js\n/**\n * Convert a string to a unique hash we can use as an key\n * http://stackoverflow.com/a/7616484\n * @param  {String} str\n * @return {Number}\n */\nconst {hash} = require('ship-components-utility').Strings;\n```\n\n#### slugify\n```js\n/**\n * Convert a string into something that is url and css friendly\n * @param     {String}    str\n * @return    {String}\n */\nconst {slugify} = require('ship-components-utility').Strings;\nlet str1 = 'THis Is A!   sample--string';\nlet str2 = 'this-is-a---sample--string';\nlet result = slugify(str1);\n\nexpect(result).not.toEqual(str1);\nexpect(result).toEqual(str2);\n```\n\n#### capitalize\n```js\n/**\n * Capitalize string\n * Convert to TitleCase if more than one word\n * @param     {String}    str\n * @return    {String}\n */\nconst {capitalize} = require('ship-components-utility').Strings;\nlet str1 = 'test test';\nlet str2 = 'Test Test';\nlet result = capitalize(str1);\n\nexpect(result).not.toEqual(str1);\nexpect(result).toEqual(str2);\n```\n\n#### titleCase\n```js\n/**\n * Title case string\n * @param     {String}    str\n * @return    {String}\n */\nconst {titleCase} = require('ship-components-utility').Strings;\n```\n\n#### camelCase\n```js\n/**\n * Convert to camelCase string\n * @param     {String}    str\n * @return    {String}\n */\nconst {camelCase} = require('ship-components-utility').Strings;\n```\n\n#### toUnderscoreCase\n```js\n/**\n * Convert camel case to underscore case\n * @param     {String}    str\n * @return    {String}\n */\nconst {toUnderscoreCase} = require('ship-components-utility').Strings;\n```\n\n#### generateRandomString\n```js\n/**\n * Generates a short random String\n * @param  {Number} len\n * @return {String}\n */\nconst {generateRandomString} = require('ship-components-utility').Strings;\n```\n\n#### stringShortener\n```js\n/**\n * Shorten string\n * @param     {String}    str\n * @param     {Number}    charCount [default==100]\n * @return    {String}\n */\nconst {stringShortener} = require('ship-components-utility').Strings;\n```\n\n#### stringIsValid\n```js\n/**\n * Validate strings (name, username or email)\n *\n * @param     {String}    prop [default=email]\n * @param     {String}    str\n * @return    {Bool}\n */\nconst {stringIsValid} = require('ship-components-utility').Strings;\n```\n\n#### convertHTMLToString\n```js\n/**\n * Removes HTML tags from string\n *\n * @param     {String}    str\n * @return    {String}\n */\nconst {convertHTMLToString} = require('ship-components-utility').Strings;\nlet str = '\u003cp\u003ethis is a text for\u003cspan\u003etesting\u003c/span\u003e\u003c/p\u003e';\nlet result = convertHTMLToString(str);\n\nexpect(result).not.toEqual(str);\nexpect(result).toEqual('this is a text fortesting');\n```\n\n### Utils\n```js\nconst {Utils} = require('ship-components-utility');\n```\n\n#### objectSize\n```js\n/**\n * Returns the size of an Object\n * @param     {Object}    obj\n * @return    {Number}    size\n */\nconst {objectSize} = require('ship-components-utility').Utils;\n```\n\n#### isObject\n```js\n/**\n * Checks if value is the language type of Object\n * will skip values === null\n * @param     {Mixed}    prop\n * @return    {Bool}\n */\nconst {isObject} = require('ship-components-utility').Utils;\n```\n\n#### isFunction\n```js\n/**\n * Checks if value is classified as a Function object\n * @param     {Mixed}    prop\n * @return    {Bool}\n */\nconst {isFunction} = require('ship-components-utility').Utils;\n```\n\n#### isString\n```js\n/**\n * Checks if value is classified as a String primitive or object\n * @param     {Mixed}    prop\n * @return    {Bool}\n */\nconst {isString} = require('ship-components-utility').Utils;\n```\n\n#### isArray\n```js\n/**\n * Checks if value is classified as an Array object\n * @param     {Mixed}    prop\n * @return    {Bool}\n */\nconst {isArray} = require('ship-components-utility').Utils;\n```\n\n#### isEqualArray\n```js\n/**\n * Shallow comparison between 2 arrays\n * or envoke the callback function\n * @param  {Array} arr1\n * @param  {Array} arr2\n * @param  {Function} callback {optional}\n * @return {Bool}\n */\nconst {isEqualArray} = require('ship-components-utility').Utils;\n```\n\n#### isUndefined\n```js\n/**\n * Checks if value is undefined\n * @param     {Mixed}    prop\n * @return    {Bool}\n */\nconst {isUndefined} = require('ship-components-utility').Utils;\n```\n\n#### bind\n```js\n/**\n * Bind to itself\n * @param     {args...}\n * @return    {Undefined}\n * @example   bind(this, 'handleClick', 'handleSubmit');\n */\nconst {bind} = require('ship-components-utility').Utils;\n```\n\n#### bindAll\n```js\n/**\n * Binds methods of an object to the object itself,\n * overwriting the existing method.\n * Method names may be specified as individual arguments\n * or as arrays of method names\n * @param     {Object}  obj\n * @return    {Object}  result\n */\nconst {bindAll} = require('ship-components-utility').Utils;\n```\n\n#### unique\n```js\n/**\n * Creates a duplicate-free version of an array\n * @param     {Array}         val\n * @return    {Immutable.Set}\n */\nconst {unique} = require('ship-components-utility').Utils;\n```\n\n#### mergeDeep\n```js\n/**\n * This method is like _.assign except that it\n * recursively merges own and inherited enumerable\n * string keyed properties of source objects into the\n * destination object\n * @param     {Object}      target\n * @param     {Object}      source\n * @return    {Object}      target\n */\n\nconst {mergeDeep} = require('ship-components-utility').Utils;\n```\n\n#### deepCopy\n```js\n/**\n * Recursive object copy\n *\n * @param     {Array\u003cObjects\u003e || Objects}    obj\n * @return    {Array\u003cObjects\u003e || Objects}\n */\n\nconst {deepCopy} = require('ship-components-utility').Utils;\n```\n\n#### pluck\n```js\n/**\n * Extract a subset of keys off of an object\n *\n * @param     {Object}          src\n * @return    {Array\u003cString\u003e}   fields\n * @return    {Object}\n */\n\nconst {pluck} = require('ship-components-utility').Utils;\n```\n\n#### isIEBrowser\n```js\n/**\n * Detect IE browser\n * @param  {String}     prop\n * @return {Bool}\n */\nconst {isIEBrowser} = require('ship-components-utility').Utils;\n```\n\n#### detectIEVersion\n```js\n /**\n  * Detect IE browser version\n  * @return {String}\n  */\nconst {detectIEVersion} = require('ship-components-utility').Utils;\n```\n\n## Development\nMore examples can be found in the `examples/` folder. A development server can be run with:\n\n```shell\n$ git clone https://github.com/ship-components/ship-components-utility.git\n$ npm install\n$ npm test\n```\n\n### Webpack Configuration\nThis module is designed to be used with webpack but requires a few loaders if you are pulling the source into another project.\n\n```shell\n$ npm install webpack babel-loader --save-dev\n```\n\nBelow are is a sample of how to setup the loaders:\n\n```js\n/**\n * Relevant Webpack Configuration\n */\n{\n  [...]\n  module: {\n    loaders: [\n      // Setup support for ES6\n      {\n        test: /\\.(js|es6)$/,\n        exclude: /node_modules/,\n        loader: 'babel-loader'\n      }\n    ]\n  },\n  [...]\n}\n```\n\n## Tests\n1. `npm install`\n2. `npm test`\n\n## History\n* 2.1.1 - Fixes unambiguous imports and exports (ES vs node).\n* 2.1.0 - Updates Webpack, eslint, jest and dependencies, grunt, husky, eslint-plugin-react and coverals\n* 2.0.0 - Updates Webpack to 4.21.0, Babel to 7 (monorepo). Fixes npm warnings \u0026 security vulnerabilities.\n* 2.0.0-beta.1 - Updates Webpack to 4.3.0 as well as eslint-loader, grunt-coveralls and lint-stages to latest.\n* 1.5.2 - Bugfix for getScrollTop and testing improvements\n* 1.5.1 - Adds functions throttle and getScrollTop to Utils.\n* 1.5.0 - Adds isEqualArray function to Utils to shallow compare 2 arrays.\n* 1.4.0 - updates dev dependencies to latest version (webpack, babel, eslint, jest, coveralls, eslint-config-ship-components).\n* 1.3.2 - Removes the unnecessary babel plugins.\n* 1.3.1 - Updates jest and babel-eslint to latest version.\n* 1.3.0 - Updates the babel presets from latest to env - latest has been deprecated.\n* 1.2.2 - Adds a pre-commit hook that will run jest test and eslint before for the changed files. NOTE: please make the precommit hook to be executable for the first time (chmod +x ./.git/hooks/pre-commit)\n* 1.2.1 - Fixed an issue in getIn where it wasn't returning the defaultValue as expected\n* 1.2.0 - Added pluck function to Util and added watch:test command\n* 1.1.0 - Adds a deepCopy function to utility library to copy (recursively) objects, array of objects or date objects.\n* 1.0.0 - First major version, fixed the export module path\n* 0.1.0 - Initial\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2017\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-utility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fship-components%2Fship-components-utility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-utility/lists"}