{"id":20119214,"url":"https://github.com/harrystevens/jeezy","last_synced_at":"2025-05-06T14:32:17.048Z","repository":{"id":22508008,"uuid":"96555574","full_name":"HarryStevens/jeezy","owner":"HarryStevens","description":"JavaScript. Easy.","archived":false,"fork":false,"pushed_at":"2023-01-11T07:46:18.000Z","size":268,"stargazers_count":23,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T07:30:25.007Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jeezy","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/HarryStevens.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-07-07T16:13:50.000Z","updated_at":"2023-01-10T12:00:41.000Z","dependencies_parsed_at":"2023-01-13T22:02:36.601Z","dependency_job_id":null,"html_url":"https://github.com/HarryStevens/jeezy","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fjeezy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fjeezy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fjeezy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fjeezy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarryStevens","download_url":"https://codeload.github.com/HarryStevens/jeezy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224509424,"owners_count":17323079,"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":[],"created_at":"2024-11-13T19:14:48.433Z","updated_at":"2024-11-13T19:14:49.033Z","avatar_url":"https://github.com/HarryStevens.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jeezy\nJavaScript. Easy.\n\n[![Build Status](https://travis-ci.org/HarryStevens/jeezy.svg?branch=master)](https://travis-ci.org/HarryStevens/jeezy) [![Coverage Status](https://coveralls.io/repos/github/HarryStevens/jeezy/badge.svg?branch=master)](https://coveralls.io/github/HarryStevens/jeezy?branch=master)\n\n\u003cb\u003ejeezy\u003c/b\u003e is a JavaScript library for manipulating data. It provides lots of useful functions and has no dependencies, so it won't add a lot of code to your project.\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Tests](#tests)\n- [Contributing](#contributing)\n\n## \u003ca name=\"installation\" href=\"#installation\"\u003eInstallation\u003c/a\u003e\n\n### npm\n```bash\nnpm install jeezy --save\n```\n```js\nvar jz = require(\"jeezy\");\n```\n\n### Web browser\n\nIn vanilla, a `jz` global is exported. You can use the CDN from unpkg.\n```html\n\u003cscript src=\"https://unpkg.com/jeezy@1.13.1/lib/jeezy.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/jeezy@1.13.1/lib/jeezy.min.js\"\u003e\u003c/script\u003e\n```\nIf you'd rather host it yourself, download `jeezy.js` or `jeezy.min.js` from the [`lib` directory](https://github.com/HarryStevens/jeezy/tree/master/lib).\n```html\n\u003cscript src=\"path/to/jeezy.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"path/to/jeezy.min.js\"\u003e\u003c/script\u003e\n```\n\n## \u003ca name=\"usage\" href=\"#usage\"\u003eUsage\u003c/a\u003e\n\n### Arrays\nJavascript has many [built-in methods for manipulating arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). These functions are meant to supplement those.\n* [Arrays: Math](#array-math)\n* [Arrays: Queries](#array-queries)\n* [Arrays: Transformations](#array-transformations)\n* [Arrays: Other](#array-other)\n\n### Numbers\nJavascript has many [built-in methods for manipulating numbers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number). These functions are meant to supplement those.\n* [Numbers: Queries](#number-queries)\n* [Numbers: Other](#number-other)\n\n### Strings\nJavascript has many [built-in methods for manipulating strings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String). These functions are meant to supplement those.\n* [Strings: Cases](#string-cases)\n* [Strings: Numbers](#string-numbers)\n* [Strings: Queries](#string-queries)\n* [Strings: Transformations](#string-transformations)\n* [Strings: Other](#string-other)\n\n---\n\n### \u003ca name=\"array-math\" href=\"#array-math\"\u003eArrays: Math\u003c/a\u003e\n\nFunctions for doing math with arrays of numbers.\n\n\u003ca name=\"array-average\" href=\"#array-average\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eaverage\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns the average of an array of numbers.\n\n\u003ca name=\"array-correlationMatrix\" href=\"#array-correlationMatrix\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003ecorrelationMatrix\u003c/b\u003e(\u003ci\u003edata\u003c/i\u003e, \u003ci\u003ecolumns\u003c/i\u003e)\n\nGiven a \u003cem\u003edata\u003c/em\u003e set (an array of objects) and a list of \u003cem\u003ecolumns\u003c/em\u003e (an array with a list of numeric columns), calculate the Pearson correlation coeffient for each pair of columns and return a correlation matrix, which is an array of objects where each object takes the form `{column_x: String, column_y: String, correlation: Number}`. [Demo](https://bl.ocks.org/HarryStevens/302d078a089caf5aeb13e480b86fdaeb)\n\n\u003ca name=\"array-extent\" href=\"#array-extent\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eextent\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns the minimum and maximum values of an array of numbers as the array [min, max].\n\n\u003ca name=\"array-max\" href=\"#array-max\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003emax\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns the maximum value of an array of numbers.\n\n\u003ca name=\"array-median\" href=\"#array-median\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003emedian\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns the median of an array of numbers.\n\n\u003ca name=\"array-min\" href=\"#array-min\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003emin\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns the minimum value of an array of numbers.\n\n\u003ca name=\"array-sum\" href=\"#array-sum\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003esum\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns the sum of an array of numbers.\n\n\n### \u003ca name=\"array-queries\" href=\"#array-queries\"\u003eArrays: Queries\u003c/a\u003e\n\nFunctions for testing arrays for certain properties. Return booleans.\n\n\u003ca name=\"array-is\" href=\"#array-is\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eis\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nTests whether an element is an array. Returns *true* or *false*.\n\n\n### \u003ca name=\"array-transformations\" href=\"#array-transformations\"\u003eArrays: Transformations\u003c/a\u003e\n\nFunctions for transforming arrays.\n\n\u003ca name=\"array-columnsToValues\" href=\"#array-columnsToValues\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003ecolumnsToValues\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nExpands a two-dimensional array of objects in which the column names contain values.\n\n```js\nvar data = [{year: 2015, Bob: 6, Steve: 10}, {year: 2016, Bob: 7, Steve: 12}, {year: 2017, Bob: 4, Steve: 16}];\ndata = jz.arr.columnsToValues(data);\n/*\n[ { year: 2015, column: \"Bob\", value: 6 },\n  { year: 2016, column: \"Bob\", value: 7 },\n  { year: 2017, column: \"Bob\", value: 4 },\n  { year: 2015, column: \"Steve\", value: 10 },\n  { year: 2016, column: \"Steve\", value: 12 },\n  { year: 2017, column: \"Steve\", value: 16 } ]\n*/\njz.arr.renameProperty(data, {in: \"column\", out: \"first_name\"});\n```\n\n\u003ca name=\"array-flatten\" href=\"#array-flatten\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eflatten\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nFlattens an array of arrays into a single array.\n\n```js\nvar arrays = [[1],[2],[3]];\njz.arr.flatten(arrays); // [1, 2, 3]\n```\n\n\u003ca name=\"array-merge\" href=\"#array-merge\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003emerge\u003c/b\u003e(\u003ci\u003earray1\u003c/i\u003e, \u003ci\u003earray2\u003c/i\u003e, \u003ci\u003eproperty\u003c/i\u003e)\n\nMerges two arrays of objects on a specified property. Keeps each object of the first array, and adds the matching properties of the first matched object in the second array.\n\n\u003ca name=\"array-pivot\" href=\"#array-pivot\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003epivot\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e, \u003ci\u003estring\u003c/i\u003e)\n\nPivots an array of objects around the unique values of an attribute. Returns the unique values and the count of how many times each appears in the original array.\n\n```js\nvar json = [ { value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }, { value: 2 } ];\njz.arr.pivot(json, \"value\"); // [ { value: 1, count: 2 }, { value: 2, count: 2 }, { value: 3, count: 1 } ]\n```\n\n\u003ca name=\"array-pluck\" href=\"#array-pluck\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003epluck\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e, \u003ci\u003estring\u003c/i\u003e)\n\nReturns all the values of a specified attribute or mapping function from an array of objects.\n\n```js\nvar json = [ { value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }, { value: 2 } ];\njz.arr.pluck(json, \"value\"); // [1, 2, 3, 1, 2]\njz.arr.pluck(json, function(d){ return d.value + 1; }); // [2, 3, 4, 2, 3]\n```\n\n\u003ca name=\"array-propertyToNumber\" href=\"#array-propertyToNumber\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003epropertyToNumber\u003c/b\u003e(\u003ci\u003edata\u003c/i\u003e, \u003ci\u003estring OR array of strings\u003c/i\u003e [, \u003ci\u003ecoerce function\u003c/i\u003e])\n\nCoerces the type of a property to a number in every object in an array of objects. The second argument can be a string with a single property name, or an array of strings with one or more property names.\n\nBy default, non-numeric values will be converted to `NaN`. But you can pass an optional third argument – a \u003ci\u003ecoerce function\u003c/i\u003e to decide how to deal with non-numeric values. However, if the function you pass returns a non-numeric value, that value will itself be coerced to `NaN`.\n\nExamples of coerce functions are:\n```js\nfunction(d){ return jz.str.keepNumber(d); }\nfunction(d){ return 0; }\n```\n\n\u003ca name=\"array-removeItem\" href=\"#array-removeItem\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eremoveItem\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e, \u003ci\u003eitem\u003c/i\u003e)\n\nRemoves an item from an array, and returns the array.\n\n\u003ca name=\"array-removeProperty\" href=\"#array-removeProperty\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eremoveProperty\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e, \u003ci\u003eproperty string OR array of property strings\u003c/i\u003e)\n\nRemoves a property or properties from every object in an array of objects. The second argument can be a string or, if you want to remove multiple properties, an array of strings.\n\n```js\nvar json = [ { value: 1, name: \"Bob\", age: 30 }, { value: 2, name: \"Steve\", age: 23 }, { value: 3, name: \"John\", age: 40 }, { value: 1, name: \"Tim\", age: 6 }, { value: 2, name: \"Jake\", age: 92 } ];\njz.arr.removeProperty(json, \"age\"); // [ { value: 1, name: \"Bob\" }, { value: 2, name: \"Steve\" }, { value: 3, name: \"John\" }, { value: 1, name: \"Tim\" }, { value: 2, name: \"Jake\" } ]\njz.arr.removeProperty(json, [\"value\", \"age\"]); // [ { name: \"Bob\" }, { name: \"Steve\" }, { name: \"John\" }, { name: \"Tim\" }, { name: \"Jake\" } ]\n```\n\n\u003ca name=\"array-renameProperty\" href=\"#array-renameProperty\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003erenameProperty\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e, \u003ci\u003erenamer\u003c/i\u003e)\n\nRenames a property or properties in every object of an array of objects. You must pass a \"renamer\" as the second argument. If you are only renaming one property, the renamer can be an object with the properties \"in\", the value of which is a string with the input property name, and \"out\", the value of which is a string with the output property name. If you are renaming multiple properties, the renamer can be an array of objects, where each object has the \"in\" and \"out\" properties of the single renamer.\n\n```js\nvar json = [ { value: 1, name: \"Bob\", age: 30 }, { value: 2, name: \"Steve\", age: 23 } ];\njz.arr.renameProperty(json, {in: \"value\", out: \"number\"}) // [ { number: 1, name: \"Bob\", age: 30 }, { number: 2, name: \"Steve\", age: 23 } ];\njz.arr.renameProperty(json, [{in: \"value\", out: \"number\"}, {in: \"age\", out: \"shoes\"}]); // [ { number: 1, name: \"Bob\", shoes: 30 }, { number: 2, name: \"Steve\", shoes: 23 } ];\n```\n\n\u003ca name=\"array-shuffle\" href=\"#array-shuffle\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eshuffle\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nShuffles an array.\n\n\u003ca name=\"array-sortBy\" href=\"#array-sortBy\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003esortBy\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e[, \u003ci\u003eorder\u003c/i\u003e])\n\nSorts an array of objects by the values of an attribute. The attribute can be either a string representing a property in each object, or an accessor modifying each object. You can specify the order of the sort as descending or ascending by using \"desc\" or \"asc\" as the optional third argument. If there is no third argument, the sort order defaults to ascending.\n\n```js\nvar json = [ { value: \"a\", count: 2 }, { value: \"b\", count: 2 }, { value: \"c\", count: 1 } ]\njz.arr.sortBy(json, \"count\"); // [ { value: \"c\", count: 1 }, { value: \"a\", count: 2 }, { value: \"b\", count: 2 } ]\njz.arr.sortBy(json, \"count\", \"asc\"); // [ { value: \"c\", count: 1 }, { value: \"a\", count: 2 }, { value: \"b\", count: 2 } ]\njz.arr.sortBy(json, \"count\", \"desc\"); // [ { value: \"b\", count: 2 }, { value: \"a\", count: 2 }, { value: \"c\", count: 1 } ]\n```\n\n\u003ca name=\"array-sortNumbers\" href=\"#array-sortNumbers\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003esortNumbers\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e[, \u003ci\u003eorder\u003c/i\u003e])\n\nSorts an array of numbers in ascending order by default. For descending order, pass \"desc\" as \u003ci\u003eorder\u003c/i\u003e.\n\n\u003ca name=\"array-unique\" href=\"#array-unique\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eunique\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns unique values of an array.\n\n\u003ca name=\"array-uniqueBy\" href=\"#array-uniqueBy\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003euniqueBy\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e, \u003ci\u003estring\u003c/i\u003e)\n\nReturns an array of unique values of an object property or mapping function in an array of objects.\n\n```js\nvar json = [ { value: 1, name: \"Bob\", age: 6}, { value: 2, name: \"Steve\", age: 6}, { value: 3, name: \"John\", age: 6}, { value: 1, name: \"Tim\", age: 23}, { value: 2, name: \"Jake\", age: 30}, { value: 3, name: \"John\", age: 40}, { value: 1, name: \"Tim\", age: 92} ];\njz.arr.uniqueBy(json, \"age\"); // [ 6, 23, 30, 40, 92 ]\njz.arr.uniqueBy(json, \"name\"); // [ \"Bob\", \"Steve\", \"John\", \"Tim\", \"Jake\" ]\njz.arr.uniqueBy(json, \"value\"); // [ 1, 2, 3 ]\njz.arr.uniqueBy(json, function(d){ return d.value + 1; }); // [2, 3, 4]\n```\n\n### \u003ca name=\"array-other\" href=\"#array-other\"\u003eArrays: Other\u003c/a\u003e\n\nMiscellaneous array functions.\n\n\u003ca name=\"array-deepCopy\" href=\"#array-deepCopy\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003edeepCopy\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns a deep copy of an array.\n\n\u003ca name=\"array-random\" href=\"#array-random\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003erandom\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns a random item from an array.\n\n\u003ca name=\"array-shallowCopy\" href=\"#array-shallowCopy\"\u003e#\u003c/a\u003e jz.arr.\u003cb\u003eshallowCopy\u003c/b\u003e(\u003ci\u003earray\u003c/i\u003e)\n\nReturns a shallow copy of an array.\n\n---\n\n### \u003ca name=\"number-queries\" href=\"#number-queries\"\u003eNumbers: Queries\u003c/a\u003e\n\nFunctions for testing numbers for certain properties.\n\n\u003ca name=\"number-isEven\" href=\"#number-isEven\"\u003e#\u003c/a\u003e jz.num.\u003cb\u003eisEven\u003c/b\u003e(\u003ci\u003einteger\u003c/i\u003e)\n\nTests whether an integer is even.\n\n### \u003ca name=\"number-other\" href=\"#number-other\"\u003eNumbers: Other\u003c/a\u003e\n\nMiscellaneous number functions.\n\n\u003ca name=\"number-randBetween\" href=\"#number-randBetween\"\u003e#\u003c/a\u003e jz.num.\u003cb\u003erandBetween\u003c/b\u003e(\u003ci\u003emin\u003c/i\u003e, \u003ci\u003emax\u003c/i\u003e)\n\nReturns a random integer between two specified integers. If the second integer is less than the first, returns the first.\n\n---\n\n### \u003ca name=\"string-cases\" href=\"#string-cases\"\u003eStrings: Cases\u003c/a\u003e\n\nFunctions for changing the case of words and characters.\n\n\u003ca name=\"string-toCamelCase\" href=\"#string-toCamelCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003etoCamelCase\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTransforms a string into camel case.\n\n```js\njz.str.toCamelCase(\"Hello world!\"); // \"helloWorld\"\n```\n\n\u003ca name=\"string-toSentenceCase\" href=\"#string-toSentenceCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003etoSentenceCase\u003c/b\u003e(\u003ci\u003estring[, boolean]\u003c/i\u003e)\n\nCapitalizes the first letter of the first word in a string. Defaults to ignoring capital letters after the first letter. Set the second argument to `true` to include them.\n\n```js\nvar string = \"new rules grant F.B.I., DEA \u0026 CIA access to 'raw' NSA surveillance data\";\njz.str.toSentenceCase(string); // \"New rules grant F.B.I., DEA \u0026 CIA access to 'raw' NSA surveillance data\"\njz.str.toSentenceCase(string, true); // \"New rules grant f.b.i., dea \u0026 cia access to 'raw' nsa surveillance data\"\n```\n\n\u003ca name=\"string-toSlugCase\" href=\"#string-toSlugCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003etoSlugCase\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTransforms a string into a slug.\n\n```js\njz.str.toSlugCase(\"Hello world!\"); // \"hello-world\"\n```\n\n\u003ca name=\"string-toSnakeCase\" href=\"#string-toSnakeCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003etoSnakeCase\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTransforms a string into snake case.\n\n```js\njz.str.toSnakeCase(\"Hello world!\"); // \"hello_world\"\n```\n\n\u003ca name=\"string-toStartCase\" href=\"#string-toStartCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003etoStartCase\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nCapitalizes the first letter of every word in a string. Defaults to ignoring capital letters after the first letter. Set the second argument to `true` to include them.\n\n```js\njz.str.toStartCase(\"Hello world!\"); // \"Hello World!\";\n\nvar string = \"new rules grant F.B.I., DEA \u0026 CIA access to 'raw' NSA surveillance data\";\njz.str.toStartCase(string); // \"New Rules Grant F.B.I., DEA \u0026 CIA Access To 'Raw' NSA Surveillance Data\"\njz.str.toStartCase(string, true); // \"New Rules Grant F.b.i., Dea \u0026 Cia Access To 'Raw' Nsa Surveillance Data\"\n```\n\n\u003ca name=\"string-toTitleCase\" href=\"#string-toTitleCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003etoTitleCase\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e[, \u003ci\u003earray\u003c/i\u003e, \u003ci\u003eboolean\u003c/i\u003e])\n\nTransforms a string into title case, where the first letter of every word is capitalized except for certain prepositions, articles and conjunctions.\n\n```js\njz.str.toTitleCase(\"the quick brown fox jumps over the lazy dog\"); // \"The Quick Brown Fox Jumps over the Lazy Dog\"\njz.str.toTitleCase(\"javascript: a beginner's guide to the language of the web\"); // Javascript: A Beginner's Guide to the Language of the Web\njz.str.toTitleCase(\"james comey to remain on as FBI director\"); // \"James Comey to Remain on as FBI Director\"\njz.str.toTitleCase(\"new rules grant FBI, DEA \u0026 CIA access to raw NSA surveillance data\"); // New Rules Grant FBI, DEA \u0026 CIA Access to Raw NSA Surveillance Data\n```\n\n### \u003ca name=\"string-numbers\" href=\"#string-numbers\"\u003eStrings: Numbers\u003c/a\u003e\n\nFunctions for manipulating numbers as strings.\n\n\u003ca name=\"string-numberCommas\" href=\"#string-numberCommas\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003enumberCommas\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nAdds commas to a number string for thousands, millions, billions, and so on.\n\n\u003ca name=\"string-numberDecimals\" href=\"#string-numberDecimals\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003enumberDecimals\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003enumber\u003c/i\u003e)\n\nRounds a number string, both float and integer, to the nearest specified decimal place.\n\n```js\njz.str.numberDecimals(\"1\", 2); // \"1.00\"\njz.str.numberDecimals(\"1.235\", 2); // \"1.24\"\n```\n\n\u003ca name=\"string-numberLakhs\" href=\"#string-numberLakhs\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003enumberLakhs\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nAdds commas to a number string for thousands, lakhs, crores, and so on. This is according to the [Indian numbering system](https://en.wikipedia.org/wiki/Indian_numbering_system).\n\n\u003ca name=\"string-numberOrdinal\" href=\"#string-numberOrdinal\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003enumberOrdinal\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nReturns an ordinal number (1st, 2nd, 3rd, 4th, ...).\n\n\u003ca name=\"string-numberPrepend\" href=\"#string-numberPrepend\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003enumberPrepend\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003enumber\u003c/i\u003e, \u003ci\u003eprepend_character\u003c/i\u003e)\n\nAdds a `prepend_character` before a string so that the length of the string equals a given number of characters. Does nothing to the string if it is already the same length or longer than the number of characters.\nIf you do not specify a `prepend_character`, it defaults to `\"0\"`. If you specify a `prepend_character` of length greater than one, it uses just the first character.\n```js\njz.str.numberPrepend(\"1234\", 6); // \"001234\"\n```\n\n### \u003ca name=\"string-queries\" href=\"#string-queries\"\u003eStrings: Queries\u003c/a\u003e\n\nFunctions for testing strings for certain properties.\n\n\u003ca name=\"string-count\" href=\"#string-count\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ecount\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e)\n\nCounts the number of times a substring occurs in a string.\n\n\u003ca name=\"string-endsWith\" href=\"#string-endsWith\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eendsWith\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e[, \u003ci\u003eboolean\u003c/i\u003e])\n\nTests whether a string ends with a substring. Defaults to case sensitive, but you can set the third argument to \u003ci\u003etrue\u003c/i\u003e for case insensitive.\n\n```js\njz.str.endsWith(\"Hello world\", \"LD\"); // false\njz.str.endsWith(\"Hello world\", \"LD\", true); // true\njz.str.endsWith(\"Hello world\", \"LD\", false); // false\n```\n\n\u003ca name=\"string-firstLetter\" href=\"#string-firstLetter\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003efirstLetter\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nReturns the first letter of a string. If there are no letters in the string, returns `null`.\n\n```js\njz.str.firstLetter(\"Hello world!\"); // \"H\"\njz.str.firstLetter(\"!!Hello world!\"); // \"H\"\njz.str.firstLetter(\"!\"); // null\n```\n\n\u003ca name=\"string-hasDigit\" href=\"#string-hasDigit\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ehasDigit\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTests whether a string contains any digits.\n\n\u003ca name=\"string-includes\" href=\"#string-includes\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eincludes\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003estring\u003c/i\u003e[, \u003ci\u003eboolean\u003c/i\u003e])\n\nTests whether a string includes a substring. Defaults to case sensitive, but you can set the third argument to \u003ci\u003etrue\u003c/i\u003e for case insensitive.\n\n```js\njz.str.includes(\"Hello world\", \"WO\"); // false\njz.str.includes(\"Hello world\", \"WO\", true); // true\njz.str.includes(\"Hello world\", \"WO\", false); // false\n```\n\n\u003ca name=\"string-isAllCaps\" href=\"#string-isAllCaps\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eisAllCaps\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTests whether a string contains only capital letters. Ignores symbols and numbers.\n\n```js\njz.str.isAllCaps(\"JEEZY\"); // true\njz.str.isAllCaps(\"JEE-ZY\"); // true\njz.str.isAllCaps(\"JEEZy\"); // false\n```\n\n\u003ca name=\"string-isAllDigits\" href=\"#string-isAllDigits\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eisAllDigits\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTests whether a string contains only digits.\n\n\u003ca name=\"string-isAllLower\" href=\"#string-isAllLower\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eisAllLower\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTests whether a string contains only lowercase letters. Ignores symbols and numbers.\n\n```js\njz.str.isAllLower(\"jeezy\"); // true\njz.str.isAllLower(\"jee-zy\"); // true\njz.str.isAllLower(\"Jeezy\"); // false\n```\n\n\u003ca name=\"string-isUpperCase\" href=\"#string-isUpperCase\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eisUpperCase\u003c/b\u003e(\u003ci\u003echaracter\u003c/i\u003e)\n\nTests whether a character is upper case.\n\n\u003ca name=\"string-startsWith\" href=\"#string-startsWith\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003estartsWith\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e[, \u003ci\u003eboolean\u003c/i\u003e])\n\nTests whether a string starts with a substring. Defaults to case sensitive, but you can set the third argument to \u003ci\u003etrue\u003c/i\u003e for case insensitive.\n\n```js\njz.str.startsWith(\"Hello world\", \"he\"); // false\njz.str.startsWith(\"Hello world\", \"he\", true); // true\njz.str.startsWith(\"Hello world\", \"he\", false); // false\n```\n\n### \u003ca name=\"string-transformations\" href=\"#string-transformations\"\u003eStrings: Transformations\u003c/a\u003e\n\nFunctions for applying various transformations to strings.\n\n\u003ca name=\"string-acronym\" href=\"#string-acronym\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eacronym\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nTurns a string into an acronym.\n\n\u003ca name=\"string-keepAll\" href=\"#string-keepAll\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ekeepAll\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e)\n\nKeeps all instances of a substring in a string. Removes everything else. Returns a blank string if the substring does not appear in the original string.\n\n\u003ca name=\"string-keepEnd\" href=\"#string-keepEnd\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ekeepEnd\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003enumber\u003c/i\u003e)\n\nKeeps a certain number of characters at the end of a string and removes the rest.\n\n\u003ca name=\"string-keepNumber\" href=\"#string-keepNumber\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ekeepNumber\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nKeeps only digits and periods in a string.\n\n```js\n+jz.str.keepNumber(\"254.62px\"); // 254.62\n```\n\n\u003ca name=\"string-keepOne\" href=\"#string-keepOne\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ekeepOne\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003estring\u003c/i\u003e)\n\nKeeps one instance of a substring in a string, even if the substring appears multiple times. Removes everything else. Returns a blank string if the substring does not appear in the original string.\n\n\u003ca name=\"string-keepStart\" href=\"#string-keepStart\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ekeepStart\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003enumber\u003c/i\u003e)\n\nKeeps a certain number of characters at the start of a string and removes the rest.\n\n\u003ca name=\"string-removeAll\" href=\"#string-removeAll\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eremoveAll\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e)\n\nRemoves all instances of a substring from a string.\n\n\u003ca name=\"string-removeDigits\" href=\"#string-removeDigits\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eremoveDigits\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nRemoves all digits from a string.\n\n```js\njz.str.removeDigits(\"H1e2l3lo w45orld!6\"); // Hello world!\n```\n\n\u003ca name=\"string-removeFirst\" href=\"#string-removeFirst\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eremoveFirst\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e)\n\nRemoves the first instance of a substring from a string.\n\n\u003ca name=\"string-removeLast\" href=\"#string-removeLast\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eremoveLast\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstring\u003c/i\u003e)\n\nRemoves the last instance of a substring from a string.\n\n\u003ca name=\"string-removeSymbols\" href=\"#string-removeSymbols\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eremoveSymbols\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nRemoves anything that is not a letter or a space from a string.\n\n\u003ca name=\"string-removeTags\" href=\"#string-removeTags\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eremoveTags\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e[, \u003ci\u003earray\u003c/i\u003e])\n\nRemoves HTML tags from a string. You can pass an optional array with the tags you want to keep.\n\n```js\njz.str.removeTags(\"\u003cspan\u003e\u003ci\u003eHello\u003c/i\u003e \u003cb\u003eworld\u003c/b\u003e!\u003c/span\u003e\"); // Hello world!\njz.str.removeTags(\"\u003cspan\u003e\u003ci\u003eHello\u003c/i\u003e \u003cb\u003eworld\u003c/b\u003e!\u003c/span\u003e\", [\"i\", \"span\"]); // \u003cspan\u003e\u003ci\u003eHello\u003c/i\u003e world!\u003c/span\u003e\n```\n\n\u003ca name=\"string-replaceAll\" href=\"#string-replaceAll\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ereplaceAll\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstringA\u003c/i\u003e, \u003ci\u003esubstringB\u003c/i\u003e)\n\nReplaces all instances of substring A in a string with substring B.\n\n```js\njz.str.replaceAll(\"Hello world!\", \"l\", \"z\"); // Hezzo worzd!\n```\n\n\u003ca name=\"string-replaceAt\" href=\"#string-replaceAt\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ereplaceAt\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003eindex\u003c/i\u003e, \u003ci\u003ereplacement\u003c/i\u003e)\n\nReplaces the characters of a string with another string beginning at a specific index.\n\n```js\njz.str.replaceAt(\"Hello world!\", 6, \"Jonny\"); // Hello Jonny!\n```\n\n\u003ca name=\"string-replaceFirst\" href=\"#string-replaceFirst\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ereplaceFirst\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstringA\u003c/i\u003e, \u003ci\u003esubstringB\u003c/i\u003e)\n\nReplaces the first instance of substring A in a string with substring B. Uses the same functionality as the [native Javascript String.replace() method](http://www.w3schools.com/jsref/jsref_replace.asp).\n\n```js\njz.str.replaceFirst(\"Hello world!\", \"l\", \"z\"); // Hezlo world!\njz.str.replaceFirst(\"Hello world!\", \"ll\", \"zz\"); // Hezzo world!\n```\n\n\u003ca name=\"string-replaceLast\" href=\"#string-replaceLast\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ereplaceLast\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003esubstringA\u003c/i\u003e, \u003ci\u003esubstringB\u003c/i\u003e)\n\nReplaces the last instance substring A in a string with substring B.\n\n```js\njz.str.replaceLast(\"Hello world!\", \"l\", \"z\"); // Hello worzd!\n```\n\n\u003ca name=\"string-reverseCharacters\" href=\"#string-reverseCharacters\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ereverseCharacters\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nReverses the order of a string's characters.\n\n\u003ca name=\"string-reverseWords\" href=\"#string-reverseWords\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003ereverseWords\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nReverses the order of a string's words.\n\n\u003ca name=\"string-shuffleCharacters\" href=\"#string-shuffleCharacters\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eshuffleCharacters\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nRandomly shuffles a string's characters. Uses the [Fischer-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle).\n\n\u003ca name=\"string-shuffleCharactersInWords\" href=\"#string-shuffleCharactersInWords\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eshuffleCharactersInWords\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nRandomly shuffles the characters of each word, but keeps the words in order. Uses the [Fischer-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle).\n\n\u003ca name=\"string-shuffleWords\" href=\"#string-shuffleWords\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003eshuffleWords\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e)\n\nRandomly shuffles a string's words. Uses the [Fischer-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle).\n\n### \u003ca name=\"string-other\" href=\"#string-other\"\u003eStrings: Other\u003c/a\u003e\n\n\u003ca name=\"string-randomString\" href=\"#string-randomString\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003erandomString\u003c/b\u003e(\u003ci\u003en\u003c/i\u003e)\n\nCreates a string of randomized characters of `n` length. If `n` is not specified, the string will be 5 characters long.\n\n\u003ca name=\"string-splitAfterFirst\" href=\"#string-splitAfterFirst\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003esplitAfterFirst\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003echar\u003c/i\u003e)\n\nSplit a string at the first instance of a character or a sequence of characters (`char`). Returns an array with two items. The first item is everything that came before `char`, while the second item is everything that came after. `char` itself is removed.\n\n```js\njz.str.splitAfterFirst(\"Hello world\", \"o\"); // [\"Hell\", \" world\"]\njz.str.splitAfterFirst(\"Good morning world\", \"or\"); // [\"Good m\", \"ning world\"]\njz.str.splitAfterFirst(\"Hello world\", \"x\"); // [\"Hello world\", \"\"]\n```\n\n\u003ca name=\"string-splitAfterLast\" href=\"#string-splitAfterLast\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003esplitAfterLast\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003echar\u003c/i\u003e)\n\nSplit a string at the last instance of a character or a sequence of characters (`char`). Returns an array with two items. The first item is everything that came before `char`, while the second item is everything that came after. `char` itself is removed.\n\n```js\njz.str.splitAfterLast(\"Hello world\", \"o\"); // [\"Hello w\", \"rld\"]\njz.str.splitAfterLast(\"Good morning world\", \"or\"); // [\"Good morning w\", \"ld\"]\njz.str.splitAfterLast(\"Hello world\", \"x\"); // [\"Hello world\", \"\"]\n```\n\n\u003ca name=\"string-splitAtIndex\" href=\"#string-splitAtIndex\"\u003e#\u003c/a\u003e jz.str.\u003cb\u003esplitAtIndex\u003c/b\u003e(\u003ci\u003estring\u003c/i\u003e, \u003ci\u003enumber OR array of numbers\u003c/i\u003e)\n\nSplit a string at a numerical index or at each index in an array of numerical indices.\n\n```js\njz.str.splitAtIndex(\"Hello world\", \"Hello world\".length - 1); // [\"Hello worl\", \"d\"]\njz.str.splitAtIndex(\"Hello world\", [1, \"Hello world\".length - 1]); // [\"H\", \"ello worl\", \"d\"]\n```\n\n## \u003ca name=\"tests\" href=\"#tests\"\u003eTests\u003c/a\u003e\n\n```bash\nnpm test # Test\nnpm run cover # Test and run a coverage report\n```\n\n## \u003ca name=\"contributing\" href=\"#contributing\"\u003eContributing\u003c/a\u003e\n\njeezy uses [rollup](https://rollupjs.org/) to bundle several small modules, usually containing just one function, into a library. To add a function, create a file in the appropriate subdirectory within the [`src` directory](https://github.com/HarryStevens/jeezy/tree/master/src), and then export it from [`arrays.js`](https://github.com/HarryStevens/jeezy/blob/master/src/arr/arrays.js), [`numbers.js`](https://github.com/HarryStevens/jeezy/blob/master/src/num/numbers.js), or [`strings.js`](https://github.com/HarryStevens/jeezy/blob/master/src/str/strings.js). \n\nTo bundle the library:\n```bash\nnpm run rollup # Bundle\nnpm run build # Bundle and minify\n```\n\nIn lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrystevens%2Fjeezy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrystevens%2Fjeezy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrystevens%2Fjeezy/lists"}