{"id":13447407,"url":"https://github.com/angus-c/just","last_synced_at":"2025-05-13T17:04:40.418Z","repository":{"id":9411790,"uuid":"61969625","full_name":"angus-c/just","owner":"angus-c","description":"A library of dependency-free JavaScript utilities that do just one thing.","archived":false,"fork":false,"pushed_at":"2024-02-11T12:23:37.000Z","size":22879,"stargazers_count":6140,"open_issues_count":52,"forks_count":209,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-05-06T16:17:03.296Z","etag":null,"topics":["dependency-free","javascript","library","pwa","tiny","typescript","utilities","utils"],"latest_commit_sha":null,"homepage":"https://anguscroll.com/just","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/angus-c.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-26T02:04:54.000Z","updated_at":"2025-05-06T06:51:58.000Z","dependencies_parsed_at":"2024-02-04T16:20:28.498Z","dependency_job_id":"633ba140-fbf5-45e5-83ad-b0aa87f04953","html_url":"https://github.com/angus-c/just","commit_stats":{"total_commits":929,"total_committers":102,"mean_commits":9.107843137254902,"dds":"0.31646932185145316","last_synced_commit":"d8c5dd18941062d8db7e9310ecc8f53fd607df54"},"previous_names":[],"tags_count":337,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angus-c%2Fjust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angus-c%2Fjust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angus-c%2Fjust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angus-c%2Fjust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angus-c","download_url":"https://codeload.github.com/angus-c/just/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252851842,"owners_count":21814227,"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":["dependency-free","javascript","library","pwa","tiny","typescript","utilities","utils"],"created_at":"2024-07-31T05:01:16.748Z","updated_at":"2025-05-13T17:04:40.372Z","avatar_url":"https://github.com/angus-c.png","language":"JavaScript","readme":"\u003c!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE --\u003e\n\u003c!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template --\u003e\n\n# Just\n\n## [Docs](#the-modules-package) | [Why?](#read-books) | [Try It](https://anguscroll.com/just) | [Contribute!](https://github.com/angus-c/just/blob/master/CONTRIBUTING.md)\n\nA library of **zero-dependency** npm modules that do just one thing.\nA guilt-free alternative to those bulkier utility libraries. Ideal for PWA development or whenever bytes are precious.\n\n![Build status](https://github.com/angus-c/just/actions/workflows/node.js.yml/badge.svg)\n\nWe welcome contributions. Please follow our [contribution guidelines](https://github.com/angus-c/just/blob/master/CONTRIBUTING.md).\n\n## Try :icecream:\n\nA [REPL](https://anguscroll.com/just) for every utility (powered by [RunKit](https://runkit.com))\n\n\u003ca href=\"https://anguscroll.com/just\"\u003e\u003cimg src=\"images/repl.png\" width=\"500\"/\u003e\u003c/a\u003e\n\n## Read :books:\n\n- [TRADEOFFS.md](https://github.com/angus-c/just/blob/master/TRADEOFFS.md) -- When to use Just (and when not to).\n- [The Zen of Dependency-Free](https://medium.com/@angustweets/just-a12d54221f65#.ljib0mfr5) -- Why I wrote Just.\n\n## ES and CJS modules available for every utility \u003cimg src=\"images/esm.png\" width=\"22\"/\u003e \u003cimg src=\"images/node.jpeg\" width=\"18\"/\u003e\n\nAll packages support ES module or Common JS syntax without requiring transpilation\n```\n// esm (node / bundler)\nimport clone from 'just-clone';\n\n// esm (native browser code)\nimport clone from './node_modules/just-clone/index.mjs';\n\n// cjs\nconst clone = require('just-clone');\n```\n## TypeScript \u003cimg src=\"images/ts.png\" width=\"18\"/\u003e\n\nWe've now added TypeScript definitions and tests for every Just utility\n\n## Browser/Platform Support :computer:\n\nMost utilities still work with any platform that supports ES5, but these are the earliest versions guranteed to support _every_ utility. For guidance, any platform that supports [spread in array literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#spread_in_array_literals) will work with Just.\n\n| Chrome | Safari | Firefox | Edge | Node | Mobile Safari | Android Chrome      |\n| ------ | ------ | ------- | ---- | ---- | ------------- | ------------- |\n| 46    | 8    | 16     | 12   | 6.0   | 8        | 46 |\n\n## The Modules :package:\n\n- [Collections](#collections) {}[]\n  - [just-diff](#just-diff)\n  - [just-diff-apply](#just-diff-apply)\n  - [just-compare](#just-compare)\n  - [just-clone](#just-clone)\n  - [just-pluck-it](#just-pluck-it)\n  - [just-flush](#just-flush)\n- [Objects](#objects) {}\n  - [just-extend](#just-extend)\n  - [just-merge](#just-merge)\n  - [just-values](#just-values)\n  - [just-entries](#just-entries)\n  - [just-pick](#just-pick)\n  - [just-omit](#just-omit)\n  - [just-filter-object](#just-filter-object)\n  - [just-map-object](#just-map-object)\n  - [just-map-values](#just-map-values)\n  - [just-map-keys](#just-map-keys)\n  - [just-deep-map-values](#just-deep-map-values)\n  - [just-reduce-object](#just-reduce-object)\n  - [just-is-empty](#just-is-empty)\n  - [just-is-circular](#just-is-circular)\n  - [just-is-primitive](#just-is-primitive)\n  - [just-safe-get](#just-safe-get)\n  - [just-safe-set](#just-safe-set)\n  - [just-typeof](#just-typeof)\n  - [just-flip-object](#just-flip-object)\n  - [just-has](#just-has)\n- [Arrays](#arrays) []\n  - [just-cartesian-product](#just-cartesian-product)\n  - [just-unique](#just-unique)\n  - [just-flatten-it](#just-flatten-it)\n  - [just-index](#just-index)\n  - [just-insert](#just-insert)\n  - [just-intersect](#just-intersect)\n  - [just-compact](#just-compact)\n  - [just-last](#just-last)\n  - [just-tail](#just-tail)\n  - [just-random](#just-random)\n  - [just-shuffle](#just-shuffle)\n  - [just-split](#just-split)\n  - [just-split-at](#just-split-at)\n  - [just-order-by](#just-order-by)\n  - [just-sort-by](#just-sort-by)\n  - [just-partition](#just-partition)\n  - [just-permutations](#just-permutations)\n  - [just-range](#just-range)\n  - [just-remove](#just-remove)\n  - [just-union](#just-union)\n  - [just-zip-it](#just-zip-it)\n  - [just-group-by](#just-group-by)\n- [Statistics](#stats) Σ\n  - [just-mean](#just-mean)\n  - [just-median](#just-median)\n  - [just-mode](#just-mode)\n  - [just-percentile](#just-percentile)\n  - [just-variance](#just-variance)\n  - [just-standard-deviation](#just-standard-deviation)\n  - [just-skewness](#just-skewness)\n- [Strings](#strings) \"\"\n  - [just-template](#just-template)\n  - [just-truncate](#just-truncate)\n  - [just-prune](#just-prune)\n  - [just-squash](#just-squash)\n  - [just-left-pad](#just-left-pad)\n  - [just-right-pad](#just-right-pad)\n  - [just-camel-case](#just-camel-case)\n  - [just-kebab-case](#just-kebab-case)\n  - [just-snake-case](#just-snake-case)\n  - [just-pascal-case](#just-pascal-case)\n  - [just-capitalize](#just-capitalize)\n  - [just-replace-all](#just-replace-all)\n- [Numbers](#numbers) +-\n  - [just-clamp](#just-clamp)\n  - [just-is-prime](#just-is-prime)\n  - [just-modulo](#just-modulo)\n  - [just-random-integer](#just-random-integer)\n- [Functions](#functions) =\u003e\n  - [just-compose](#just-compose)\n  - [just-curry-it](#just-curry-it)\n  - [just-demethodize](#just-demethodize)\n  - [just-flip](#just-flip)\n  - [just-partial-it](#just-partial-it)\n  - [just-pipe](#just-pipe)\n  - [just-debounce-it](#just-debounce-it)\n  - [just-memoize](#just-memoize)\n  - [just-memoize-last](#just-memoize-last)\n  - [just-random](#just-random)\n  - [just-throttle](#just-throttle)\n  - [just-once](#just-once)\n\n### Collections\n\n### [just-diff](https://www.npmjs.com/package/just-diff)\n[source](https://github.com/angus-c/just/tree/master/packages/collection-diff)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-diff)\n\n```shell\nnpm install just-diff\n```\n```shell\nyarn add just-diff\n```\n\nReturn an object representing the difference between two other objects\nPass converter to format as http://jsonpatch.com\n\n```js\nimport {diff} from 'just-diff';\n\nconst obj1 = {a: 4, b: 5};\nconst obj2 = {a: 3, b: 5};\nconst obj3 = {a: 4, c: 5};\n\ndiff(obj1, obj2);\n[\n  { \"op\": \"replace\", \"path\": ['a'], \"value\": 3 }\n]\n\ndiff(obj2, obj3);\n[\n  { \"op\": \"remove\", \"path\": ['b'] },\n  { \"op\": \"replace\", \"path\": ['a'], \"value\": 4 }\n  { \"op\": \"add\", \"path\": ['c'], \"value\": 5 }\n]\n\n// using converter to generate jsPatch standard paths\nimport {diff, jsonPatchPathConverter} from 'just-diff'\ndiff(obj1, obj2, jsonPatchPathConverter);\n[\n  { \"op\": \"replace\", \"path\": '/a', \"value\": 3 }\n]\n\ndiff(obj2, obj3, jsonPatchPathConverter);\n[\n  { \"op\": \"remove\", \"path\": '/b' },\n  { \"op\": \"replace\", \"path\": '/a', \"value\": 4 }\n  { \"op\": \"add\", \"path\": '/c', \"value\": 5 }\n]\n\n// arrays\nconst obj4 = {a: 4, b: [1, 2, 3]};\nconst obj5 = {a: 3, b: [1, 2, 4]};\nconst obj6 = {a: 3, b: [1, 2, 4, 5]};\n\ndiff(obj4, obj5);\n[\n  { \"op\": \"replace\", \"path\": ['a'], \"value\": 3 }\n  { \"op\": \"replace\", \"path\": ['b', 2], \"value\": 4 }\n]\n\ndiff(obj5, obj6);\n[\n  { \"op\": \"add\", \"path\": ['b', 3], \"value\": 5 }\n]\n\n// nested paths\nconst obj7 = {a: 4, b: {c: 3}};\nconst obj8 = {a: 4, b: {c: 4}};\nconst obj9 = {a: 5, b: {d: 4}};\n\ndiff(obj7, obj8);\n[\n  { \"op\": \"replace\", \"path\": ['b', 'c'], \"value\": 4 }\n]\n\ndiff(obj8, obj9);\n[\n  { \"op\": \"replace\", \"path\": ['a'], \"value\": 5 }\n  { \"op\": \"remove\", \"path\": ['b', 'c']}\n  { \"op\": \"add\", \"path\": ['b', 'd'], \"value\": 4 }\n]\n```\n\n### [just-diff-apply](https://www.npmjs.com/package/just-diff-apply)\n[source](https://github.com/angus-c/just/tree/master/packages/collection-diff-apply)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-diff-apply)\n\n```shell\nnpm install just-diff-apply\n```\n```shell\nyarn add just-diff-apply\n```\n\nApply a diff object to an object. Pass converter to apply a http://jsonpatch.com standard patch\n\n```js\n  import {diffApply} from 'just-diff-apply';\n\n  const obj1 = {a: 3, b: 5};\n  diffApply(obj1,\n    [\n      { \"op\": \"remove\", \"path\": ['b'] },\n      { \"op\": \"replace\", \"path\": ['a'], \"value\": 4 },\n      { \"op\": \"add\", \"path\": ['c'], \"value\": 5 }\n    ]\n  );\n  obj1; // {a: 4, c: 5}\n\n  const obj2 = {a: 3, b: 5};\n  diffApply(obj2,\n    [\n      { \"op\": \"move\", \"from\": ['a'], \"path\": ['c']},\n    ]\n  );\n  obj2; // {b: 5, c: 3}\n\n  // using converter to apply jsPatch standard paths\n  // see http://jsonpatch.com\n  import {diffApply, jsonPatchPathConverter} from 'just-diff-apply'\n  const obj3 = {a: 3, b: 5};\n  diffApply(obj3, [\n    { \"op\": \"remove\", \"path\": '/b' },\n    { \"op\": \"replace\", \"path\": '/a', \"value\": 4 }\n    { \"op\": \"add\", \"path\": '/c', \"value\": 5 }\n  ], jsonPatchPathConverter);\n  obj3; // {a: 4, c: 5}\n\n  // arrays (array key can be string or numeric)\n  const obj4 = {a: 4, b: [1, 2, 3]};\n  diffApply(obj4, [\n    { \"op\": \"replace\", \"path\": ['a'], \"value\": 3 }\n    { \"op\": \"replace\", \"path\": ['b', 2], \"value\": 4 }\n    { \"op\": \"add\", \"path\": ['b', 3], \"value\": 9 }\n  ]);\n  obj4; // {a: 3, b: [1, 2, 4, 9]}\n\n  // nested paths\n  const obj5 = {a: 4, b: {c: 3}};\n  diffApply(obj5, [\n    { \"op\": \"replace\", \"path\": ['a'], \"value\": 5 }\n    { \"op\": \"remove\", \"path\": ['b', 'c']}\n    { \"op\": \"add\", \"path\": ['b', 'd'], \"value\": 4 }\n  ]);\n  obj5; // {a: 5, b: {d: 4}}\n```\n\n### [just-compare](https://www.npmjs.com/package/just-compare)\n[source](https://github.com/angus-c/just/tree/master/packages/collection-compare)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-compare)\n\n```shell\nnpm install just-compare\n```\n```shell\nyarn add just-compare\n```\n\nCompare two collections\n\n```js\nimport compare from 'just-compare';\n\n// primitives: value1 === value2\n// functions: value1.toString == value2.toString\n// arrays: if length, sequence and values of properties are identical\n// objects: if length, names and values of properties are identical\ncompare([1, [2, 3]], [1, [2, 3]]); // true\ncompare([1, [2, 3], 4], [1, [2, 3]]); // false\ncompare({a: 2, b: 3}, {a: 2, b: 3}); // true\ncompare({a: 2, b: 3}, {b: 3, a: 2}); // true\ncompare({a: 2, b: 3, c: 4}, {a: 2, b: 3}); // false\ncompare({a: 2, b: 3}, {a: 2, b: 3, c: 4}); // false\ncompare([1, [2, {a: 4}], 4], [1, [2, {a: 4}]]); // false\ncompare([1, [2, {a: 4}], 4], [1, [2, {a: 4}], 4]); // true\ncompare(NaN, NaN); // true\n```\n\n### [just-clone](https://www.npmjs.com/package/just-clone)\n[source](https://github.com/angus-c/just/tree/master/packages/collection-clone)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-clone)\n\n```shell\nnpm install just-clone\n```\n```shell\nyarn add just-clone\n```\n\nDeep copies objects, arrays, maps and sets\n\n```js\n// Deep copies objects and arrays, doesn't clone functions\n\nimport clone from 'just-clone';\n\nvar arr = [1, 2, 3];\nvar subObj = { aa: 1 };\nvar obj = { a: 3, b: 5, c: arr, d: subObj };\nvar objClone = clone(obj);\narr.push(4);\nobjClone.d.bb = 2;\nobj; // {a: 3, b: 5, c: [1, 2, 3, 4], d: {aa: 1}}\nobjClone; // {a: 3, b: 5, c: [1, 2, 3], d: {aa: 1, bb: 2}}\n```\n\n### [just-pluck-it](https://www.npmjs.com/package/just-pluck-it)\n[source](https://github.com/angus-c/just/tree/master/packages/collection-pluck)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-pluck-it)\n\n```shell\nnpm install just-pluck-it\n```\n```shell\nyarn add just-pluck-it\n```\n\nPluck a property from each member of a collection\n\n```js\nimport pluck from 'just-pluck-it';\n\npluck([{a:1, b:2}, {a:4, b:3}, {a:2, b:5}], 'a'); // [1, 4, 2]\npluck({x: {a:1, b:2}, y: {a:4, b:3}, z: {a:2, b:5}}, 'a'); // {x: 1, y: 4, z: 2}\n```\n\n### [just-flush](https://www.npmjs.com/package/just-flush)\n[source](https://github.com/angus-c/just/tree/master/packages/collection-flush)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-flush)\n\n```shell\nnpm install just-flush\n```\n```shell\nyarn add just-flush\n```\n\nReturns a copy of an array or object with null/undefined members removed\n\n```js\nimport flush from 'just-flush';\n\nflush([1, undefined, 2, null, 3, NaN, 0]); // [1, 2, 3, NaN, 0]\nflush([true, null, false, true, [null], undefined]); // [true, false, true, [null]]\nflush({a: 2, b: null, c: 4, d: undefined}); // {a: 2, c: 4}\nflush('something'); // undefined\nflush(); // undefined\n```\n\n### Objects\n\n### [just-extend](https://www.npmjs.com/package/just-extend)\n[source](https://github.com/angus-c/just/tree/master/packages/object-extend)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-extend)\n\n```shell\nnpm install just-extend\n```\n```shell\nyarn add just-extend\n```\n\nExtend an object\n\n```js\nimport extend from 'just-extend';\n\nvar obj = {a: 3, b: 5};\nextend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}\nobj; // {a: 4, b: 5, c: 8}\n\nvar obj = {a: 3, b: 5};\nextend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}\nobj; // {a: 3, b: 5}\n\nvar arr = [1, 2, 3];\nvar obj = {a: 3, b: 5};\nextend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}\narr.push(4);\nobj; // {a: 3, b: 5, c: [1, 2, 3, 4]}\n\nvar arr = [1, 2, 3];\nvar obj = {a: 3, b: 5};\nextend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}\narr.push(4);\nobj; // {a: 3, b: 5, c: [1, 2, 3]}\n\nextend({a: 4, b: 5}); // {a: 4, b: 5}\nextend({a: 4, b: 5}, 3); {a: 4, b: 5}\nextend({a: 4, b: 5}, true); {a: 4, b: 5}\nextend('hello', {a: 4, b: 5}); // throws\nextend(3, {a: 4, b: 5}); // throws\n```\n\n### [just-merge](https://www.npmjs.com/package/just-merge)\n[source](https://github.com/angus-c/just/tree/master/packages/object-merge)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-merge)\n\n```shell\nnpm install just-merge\n```\n```shell\nyarn add just-merge\n```\n\nShallow assign. Like just-extend but without deep copy option.\n\n```js\nimport merge from 'just-merge';\n\nlet obj = {a: 3, b: 5};\nmerge(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}\nobj; // {a: 4, b: 5, c: 8}\n\nlet obj = {a: 3, b: 5};\nmerge({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}\nobj; // {a: 3, b: 5}\n\nlet arr = [1, 2, 3];\nlet obj = {a: 3, b: 5};\nmerge(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}\narr.push[4];\nobj; // {a: 3, b: 5, c: [1, 2, 3, 4]}\n\nmerge({a: 4, b: 5}); // {a: 4, b: 5}\nmerge(3, {a: 4, b: 5}); // throws\nmerge({a: 4, b: 5}, 3); // throws\nmerge({a: 4, b: 5}, {b: 4, c: 5}, 'c'); // throws\n```\n\n### [just-values](https://www.npmjs.com/package/just-values)\n[source](https://github.com/angus-c/just/tree/master/packages/object-values)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-values)\n\n```shell\nnpm install just-values\n```\n```shell\nyarn add just-values\n```\n\nReturn property values as an array\n\n```js\nconst values = require('just-values');\n\nvalues({a: 4, c: 8}); // [4, 8]\nvalues({a: {aa: 2}, b: {bb: 4}}); // [{aa: 2}, {bb: 4}]\nvalues({}); // []\nvalues([1, 2, 3]); // [1, 2, 3]\nvalues(function(a, b) {return a + b;}); // []\nvalues(new String('hello')); // ['h', 'e', 'l', 'l', 'o']\nvalues(1); // throws exception\nvalues(true); // throws exception\nvalues(undefined); // throws exception\nvalues(null); // throws exception\n```\n\n### [just-entries](https://www.npmjs.com/package/just-entries)\n[source](https://github.com/angus-c/just/tree/master/packages/object-entries)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-entries)\n\n```shell\nnpm install just-entries\n```\n```shell\nyarn add just-entries\n```\n\nReturn object entries as an array of [key, value] pairs\n\n```js\nimport entries from 'just-entries';\n\n// Object:\nentries({c: 8, a: 4}); // [['c', 8], ['a', 4]]\nentries({b: {bb: 4}, a: {aa: 2}}); // [['b', {bb: 4}], ['a', {aa: 2}]]\nentries({}); // []\n\n// Array:\nentries([{c: 8}, {a: 4}]); // [[0, {c: 8}], [1, {a: 4}]]\nentries(['À', 'mauvais', 'ouvrier', 'point', 'de', 'bon', 'outil'])\n// [[0, 'À'], [1, 'mauvais'] ... [6, 'outil']]\nentries([]); // []\n```\n\n### [just-pick](https://www.npmjs.com/package/just-pick)\n[source](https://github.com/angus-c/just/tree/master/packages/object-pick)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-pick)\n\n```shell\nnpm install just-pick\n```\n```shell\nyarn add just-pick\n```\n\nCopy an object but with only the specified keys\n\n```js\nimport pick from 'just-pick';\n\nvar obj = { a: 3, b: 5, c: 9 };\npick(obj, ['a', 'c']); // {a: 3, c: 9}\npick(obj, 'a', 'c'); // {a: 3, c: 9}\npick(obj, ['a', 'b', 'd']); // {a: 3, b: 5}\npick(obj, ['a', 'a']); // {a: 3}\n```\n\n### [just-omit](https://www.npmjs.com/package/just-omit)\n[source](https://github.com/angus-c/just/tree/master/packages/object-omit)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-omit)\n\n```shell\nnpm install just-omit\n```\n```shell\nyarn add just-omit\n```\n\nCopy an object but omit the specified keys\n\n```js\nimport omit from 'just-omit';\n\nvar obj = {a: 3, b: 5, c: 9};\nomit(obj, ['a', 'c']); // {b: 5}\nomit(obj, 'a', 'c'); // {b: 5}\nomit(obj, ['a', 'b', 'd']); // {c: 9}\nomit(obj, ['a', 'a']); // {b: 5, c: 9}\n```\n\n### [just-is-empty](https://www.npmjs.com/package/just-is-empty)\n[source](https://github.com/angus-c/just/tree/master/packages/object-is-empty)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-is-empty)\n\n```shell\nnpm install just-is-empty\n```\n```shell\nyarn add just-is-empty\n```\n\nReturn true if object has no enumerable key values\n\n```js\nimport isEmpty from 'just-is-empty';\n isEmpty({a: 3, b: 5}) // false\n isEmpty([1, 2]) // false\n isEmpty(new Set([1, 2, 2])) // false\n isEmpty((new Map()).set('a', 2)) // false\n isEmpty({}) // true\n isEmpty([]) // true\n isEmpty(new Set()) // true\n isEmpty(new Map()) // true\n isEmpty('abc') // false\n isEmpty('') // true\n isEmpty(0) // true\n isEmpty(1) // true\n isEmpty(true) // true\n isEmpty(Symbol('abc')); // true\n isEmpty(//); // true\n isEmpty(new String('abc')); // false\n isEmpty(new String('')); // true\n isEmpty(new Boolean(true)); // true\n isEmpty(null) // true\n isEmpty(undefined) // true\n```\n\n### [just-is-circular](https://www.npmjs.com/package/just-is-circular)\n[source](https://github.com/angus-c/just/tree/master/packages/object-is-circular)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-is-circular)\n\n```shell\nnpm install just-is-circular\n```\n```shell\nyarn add just-is-circular\n```\n\nReturn true if object has a circular reference\nNOTE: not supported in IE or microsoft edge\n\n```js\nimport isCircular from 'just-is-circular';\nconst a = {};\na.b = a;\nisCircular(a); // true\n\nconst a = {};\na.b = {\n  c: a\n};\nisCircular(a); // true\n\nconst a = {};\na.b = {\n  c: 4\n};\nisCircular(a); // false\n\nconst a = [];\na.push(a);\nisCircular(a); // true\n\nisCircular({}); // false\nisCircular('hi'); // false\nisCircular(undefined); // false\n```\n\n### [just-is-primitive](https://www.npmjs.com/package/just-is-primitive)\n[source](https://github.com/angus-c/just/tree/master/packages/object-is-primitive)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-is-primitive)\n\n```shell\nnpm install just-is-primitive\n```\n```shell\nyarn add just-is-primitive\n```\n\nDetermine if a value is a primitive value\n\n```js\nimport isPrimitive from 'just-is-primitive';\nisPrimitive('hi') // true\nisPrimitive(3) // true\nisPrimitive(true) // true\nisPrimitive(false) // true\nisPrimitive(null) // true\nisPrimitive(undefined) // true\nisPrimitive(Symbol()) // true\nisPrimitive({}) // false\nisPrimitive([]) // false\nisPrimitive(function() {}) // false\nisPrimitive(new Date()) // false\nisPrimitive(/a/) // false\n```\n\n### [just-filter-object](https://www.npmjs.com/package/just-filter-object)\n[source](https://github.com/angus-c/just/tree/master/packages/object-filter)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-filter-object)\n\n```shell\nnpm install just-filter-object\n```\n```shell\nyarn add just-filter-object\n```\n\nFilter an object\n\n```js\nimport filter from 'just-filter';\n\n// returns a new object containing those original properties for which the predicate returns truthy\nfilter({a: 3, b: 5, c: 9}, (key, value) =\u003e value \u003c 6); // {a: 3, b: 5}\nfilter({a1: 3, b1: 5, a2: 9}, (key, value) =\u003e key[0] == 'a'); // {a1: 3, a2: 9}\nfilter({a: 3, b: 5, c: null}, (key, value) =\u003e value); // {a: 3, b: 5}\n```\n\n### [just-map-object](https://www.npmjs.com/package/just-map-object)\n[source](https://github.com/angus-c/just/tree/master/packages/object-map)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-map-object)\n\n```shell\nnpm install just-map-object\n```\n```shell\nyarn add just-map-object\n```\n\nMap an object, passing key and value to predicates\n\n```js\nimport map from 'just-map-object';\n\n// DEPRECATED: use just-map-values\nmap({a: 3, b: 5, c: 9}, (key, value) =\u003e value + 1); // {a: 4, b: 6, c: 10}\nmap({a: 3, b: 5, c: 9}, (key, value) =\u003e key); // {a: 'a', b: 'b', c: 'c'}\nmap({a: 3, b: 5, c: 9}, (key, value) =\u003e key + value); // {a: 'a3', b: 'b5', c: 'c9'}```\n```\n\n### [just-map-values](https://www.npmjs.com/package/just-map-values)\n[source](https://github.com/angus-c/just/tree/master/packages/object-map-values)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-map-values)\n\n```shell\nnpm install just-map-values\n```\n```shell\nyarn add just-map-values\n```\n\nMap an object, predicate updates values, receives (value, key, object)\n\n```js\nimport map from 'just-map-values';\n\n// predicate updates values, receives (value, key, obj)\nmap({a: 3, b: 5, c: 9}, (value) =\u003e value + 1); // {a: 4, b: 6, c: 10}\nmap({a: 3, b: 5, c: 9}, (value, key) =\u003e value + key); // {a: 3a, b: 5b, c: 9c}\nmap({a: 3, b: 5, c: 9}, (value, key, obj) =\u003e obj.b); // {a: 5, b: 5, c: 5}\n```\n\n### [just-map-keys](https://www.npmjs.com/package/just-map-keys)\n[source](https://github.com/angus-c/just/tree/master/packages/object-map-keys)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-map-keys)\n\n```shell\nnpm install just-map-keys\n```\n```shell\nyarn add just-map-keys\n```\n\nMap an object, predicate updates keys, receives (value, key, object)\n\n```js\nimport map from 'just-map-keys';\n\n// predicate updates keys, receives (value, key, object)\nmap({a: 'cow', b: 'sheep', c: 'pig'}, (value) =\u003e value);\n  // {cow: 'cow', sheep: 'sheep', pig: 'pig'}\nmap([4, 5, 6], (value, key) =\u003e key + 1); // {1: 4, 2: 5, 3: 6}\nmap({a: 3, b: 5, c: 9}, (value, key) =\u003e key + value); // {a3: 3, b5: 5, c9: 9}\nmap({a: 3, b: 5, c: 9}, (value, key, obj) =\u003e obj.b + value + key);\n  // {'8a': 3, '10b': 5, '14c': 9}\n```\n\n### [just-deep-map-values](https://www.npmjs.com/package/just-deep-map-values)\n[source](https://github.com/angus-c/just/tree/master/packages/object-deep-map-values)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-deep-map-values)\n\n```shell\nnpm install just-deep-map-values\n```\n```shell\nyarn add just-deep-map-values\n```\n\nReturns an object with values at all depths mapped according to the provided function\n\n```js\nimport deepMapValues from 'just-deep-map-values';\n\nconst squareFn = (number) =\u003e number * number;\ndeepMapValues({ a: 1, b: { c: 2, d: { e: 3 } } }, squareFn); // =\u003e { a: 1, b: { c: 4, d: { e: 9 } } }\n```\n\n### [just-reduce-object](https://www.npmjs.com/package/just-reduce-object)\n[source](https://github.com/angus-c/just/tree/master/packages/object-reduce)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-reduce-object)\n\n```shell\nnpm install just-reduce-object\n```\n```shell\nyarn add just-reduce-object\n```\n\nReduce an object\n\n```js\nimport reduce from 'just-reduce-object';\n\n// applies a function against an accumulator and each key-value pairs of the object\n// to reduce it to a single value\nreduce({a: 3, b: 5, c: 9}, (acc, key, value, index, keys) =\u003e {\n  acc[value] = key;\n  return acc;\n}, {}); // {3: 'a', 5: 'b', 9: 'c'}\n\nreduce({a: 3, b: 5, c: 9}, (acc, key, value, index, keys) =\u003e {\n  acc += value;\n  return acc;\n}); // 17\n```\n\n### [just-safe-get](https://www.npmjs.com/package/just-safe-get)\n[source](https://github.com/angus-c/just/tree/master/packages/object-safe-get)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-safe-get)\n\n```shell\nnpm install just-safe-get\n```\n```shell\nyarn add just-safe-get\n```\n\nGet value at property, don't throw if parent is undefined\n\n```js\nimport get from 'just-safe-get';\n\nconst obj = {a: {aa: {aaa: 2}}, b: 4};\n\nget(obj, 'a.aa.aaa'); // 2\nget(obj, ['a', 'aa', 'aaa']); // 2\n\nget(obj, 'b.bb.bbb'); // undefined\nget(obj, ['b', 'bb', 'bbb']); // undefined\n\nget(obj.a, 'aa.aaa'); // 2\nget(obj.a, ['aa', 'aaa']); // 2\n\nget(obj.b, 'bb.bbb'); // undefined\nget(obj.b, ['bb', 'bbb']); // undefined\n\nget(obj.b, 'bb.bbb', 5); // 5\nget(obj.b, ['bb', 'bbb'], true); // true\n\nget(null, 'a'); // undefined\nget(undefined, ['a']); // undefined\n\nget(null, 'a', 42); // 42\nget(undefined, ['a'], 42); // 42\n\nconst obj = {a: {}};\nconst sym = Symbol();\nobj.a[sym] = 4;\nget(obj.a, sym); // 4\n```\n\n### [just-safe-set](https://www.npmjs.com/package/just-safe-set)\n[source](https://github.com/angus-c/just/tree/master/packages/object-safe-set)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-safe-set)\n\n```shell\nnpm install just-safe-set\n```\n```shell\nyarn add just-safe-set\n```\n\nSet value at property, create intermediate properties if necessary\n\n```js\nimport set from 'just-safe-set';\n\nconst obj1 = {};\nset(obj1, 'a.aa.aaa', 4); // true\nobj1; // {a: {aa: {aaa: 4}}}\n\nconst obj2 = {};\nset(obj2, ['a', 'aa', 'aaa'], 4); // true\nobj2; // {a: {aa: {aaa: 4}}}\n\nconst obj3 = {a: {aa: {aaa: 2}}};\nset(obj3, 'a.aa.aaa', 3); // true\nobj3; // {a: {aa: {aaa: 3}}}\n\nconst obj5 = {a: {}};\nconst sym = Symbol();\nset(obj5.a, sym, 7); // true\nobj5; // {a: {Symbol(): 7}}\n```\n\n### [just-typeof](https://www.npmjs.com/package/just-typeof)\n[source](https://github.com/angus-c/just/tree/master/packages/object-typeof)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-typeof)\n\n```shell\nnpm install just-typeof\n```\n```shell\nyarn add just-typeof\n```\n\nType inferer\n\n```js\nimport typeOf from 'just-typeof';\n\ntypeOf({}); // 'object'\ntypeOf([]); // 'array'\ntypeOf(function() {}); // 'function'\ntypeOf(/a/); // 'regexp'\ntypeOf(new Date()); // 'date'\ntypeOf(null); // 'null'\ntypeOf(undefined); // 'undefined'\ntypeOf('a'); // 'string'\ntypeOf(1); // 'number'\ntypeOf(true); // 'boolean'\n```\n\n### [just-flip-object](https://www.npmjs.com/package/just-flip-object)\n[source](https://github.com/angus-c/just/tree/master/packages/object-flip)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-flip-object)\n\n```shell\nnpm install just-flip-object\n```\n```shell\nyarn add just-flip-object\n```\n\nFlip the keys and values\n\n```js\nimport flip from 'just-flip-object';\n\n// flip the key and value\nflip({a: 'x', b: 'y', c: 'z'}); // {x: 'a', y: 'b', z: 'c'}\nflip({a: 1, b: 2, c: 3}); // {'1': 'a', '2': 'b', '3': 'c'}\nflip({a: false, b: true}); // {false: 'a', true: 'b'}\n```\n\n### [just-has](https://www.npmjs.com/package/just-has)\n[source](https://github.com/angus-c/just/tree/master/packages/object-has)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-has)\n\n```shell\nnpm install just-has\n```\n```shell\nyarn add just-has\n```\n\nReturn a boolen indicating the existence of a deep property, don't throw if parent is undefined\n\n```js\nimport has from 'just-has';\n\nconst obj = {a: {aa: {aaa: 2}}, b: 4};\n\nhas(obj, 'a.aa.aaa'); // true\nhas(obj, ['a', 'aa', 'aaa']); // true\n\nhas(obj, 'b.bb.bbb'); // false\nhas(obj, ['b', 'bb', 'bbb']); // false\n\nhas(obj.a, 'aa.aaa'); // true\nhas(obj.a, ['aa', 'aaa']); // true\n\nhas(obj.b, 'bb.bbb'); // false\nhas(obj.b, ['bb', 'bbb']); // false\n\nhas(null, 'a'); // false\nhas(undefined, ['a']); // false\n\nconst obj = {a: {}};\nconst sym = Symbol();\nobj.a[sym] = 4;\nhas(obj.a, sym); // true\n```\n\n### Arrays\n\n### [just-cartesian-product](https://www.npmjs.com/package/just-cartesian-product)\n[source](https://github.com/angus-c/just/tree/master/packages/array-cartesian-product)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-cartesian-product)\n\n```shell\nnpm install just-cartesian-product\n```\n```shell\nyarn add just-cartesian-product\n```\n\nTakes an input of an array of arrays and returns their Cartesian product.\n\n```js\nimport cartesianProduct from 'just-cartesian-product';\n\ncartesianProduct([[1, 2], ['a', 'b']]); // [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]\ncartesianProduct([[1, 2], ['a', 'b', 'c']]); // [[1, 'a'], [1, 'b'], [1, 'c'], [2, 'a'], [2, 'b'], [2, 'c']]\ncartesianProduct([]); // []\ncartesianProduct(); // throws\n```\n\n### [just-unique](https://www.npmjs.com/package/just-unique)\n[source](https://github.com/angus-c/just/tree/master/packages/array-unique)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-unique)\n\n```shell\nnpm install just-unique\n```\n```shell\nyarn add just-unique\n```\n\nDedupes an array\n\n```js\nimport unique from 'just-unique';\n\nunique([1, 2, 3, 2, 3, 4, 3, 2, 1, 3]); // [1, 2, 3, 4]\n\nvar a = {a: 3};\nvar b = {b: 4};\nvar c = {c: 5};\nunique([a, a, b, c, b]); // [a, b, c]\n\nunique([1, '1', 2, '2', 3, 2]); // [1, '1', 2, '2', 3]\n\n// declaring sorted array for performance\nunique([1, 1, '1', 2, 2, 5, '5', '5'], true); // [1, '1', 2, 5, '6']\n\n// declaring strings array for performance\nunique(['a', 'c', 'b', 'c', 'a'], false, true); // ['a', 'b', 'c']\n```\n\n### [just-flatten-it](https://www.npmjs.com/package/just-flatten-it)\n[source](https://github.com/angus-c/just/tree/master/packages/array-flatten)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-flatten-it)\n\n```shell\nnpm install just-flatten-it\n```\n```shell\nyarn add just-flatten-it\n```\n\nReturn a flattened array\n\n```js\nimport flatten from 'just-flatten-it';\n\nflatten([[1, [2, 3]], [[4, 5], 6, 7, [8, 9]]]);\n// [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nflatten([[1, [2, 3]], [[4, 5], 6, 7, [8, 9]]], 1);\n// [1, [2, 3], [[4, 5], 6, 7, [8, 9]]]\n```\n\n### [just-index](https://www.npmjs.com/package/just-index)\n[source](https://github.com/angus-c/just/tree/master/packages/array-index)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-index)\n\n```shell\nnpm install just-index\n```\n```shell\nyarn add just-index\n```\n\nReturn an object from an array, keyed by the value at the given id\n\n```js\nimport index from 'just-index';\n\nindex([{id: 'first', val: 1}, {id: 'second', val: 2}], 'id');\n// {first: {id: 'first', val: 1}, second: {id: 'second', val: 2}}\nindex([{id: 'first', val: 1}, null], 'id'); // {first: {id: 'first', val: 1}}\nindex([], 'id'); // {}\nindex([], null); // undefined\nindex({}, 'id'); // undefined\n```\n\n### [just-insert](https://www.npmjs.com/package/just-insert)\n[source](https://github.com/angus-c/just/tree/master/packages/array-insert)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-insert)\n\n```shell\nnpm install just-insert\n```\n```shell\nyarn add just-insert\n```\n\nInserts a sub-array into an array starting at the given index. Returns a copy\n\n```js\nimport insert from 'just-insert';\n\ninsert([1, 2, 5, 6], ['a', 'c', 'e'], 2); // [1, 2, 'a', 'c', 'e', 5, 6]\ninsert([1, 2, 5, 6], 'a', 2); // [1, 2, 'a', 5, 6]\ninsert([1, 2, 5, 6], ['a', 'c', 'e'], 0); // ['a', 'c', 'e', 1, 2, 5, 6]\ninsert([1, 2, 5, 6], ['a', 'c', 'e']); // ['a', 'c', 'e', 1, 2, 5, 6]\n```\n\n### [just-intersect](https://www.npmjs.com/package/just-intersect)\n[source](https://github.com/angus-c/just/tree/master/packages/array-intersect)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-intersect)\n\n```shell\nnpm install just-intersect\n```\n```shell\nyarn add just-intersect\n```\n\nReturn the intersect of two arrays\n\n```js\nimport intersect from 'just-intersect';\n\nintersect([1, 2, 5, 6], [2, 3, 5, 6]); // [2, 5, 6]\nintersect([1, 2, 2, 4, 5], [3, 2, 2, 5, 7]); // [2, 5]  \n```\n\n### [just-compact](https://www.npmjs.com/package/just-compact)\n[source](https://github.com/angus-c/just/tree/master/packages/array-compact)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-compact)\n\n```shell\nnpm install just-compact\n```\n```shell\nyarn add just-compact\n```\n\nReturns a copy of an array with falsey values removed\n\n```js\nimport compact from 'just-compact';\n\ncompact([1, null, 2, undefined, null, NaN, 3, 4, false, 5]); // [1, 2, 3, 4, 5]\ncompact([1, 2, [], 4, {}]); // [1, 2, [], 4, {}]\ncompact([]); // []\ncompact({}); // throws\n```\n\n### [just-last](https://www.npmjs.com/package/just-last)\n[source](https://github.com/angus-c/just/tree/master/packages/array-last)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-last)\n\n```shell\nnpm install just-last\n```\n```shell\nyarn add just-last\n```\n\nReturn the last member of an array\n\n```js\nimport last from 'just-last';\n\nlast([1, 2, 3, 4, 5]); // 5\nlast([{a: 1}, {b: 1}, {c: 1}]); // {c: 1}\nlast([true, false, [true, false]]); // [true, false]\nlast(); // undefined\nlast([]); // undefined\nlast(null); // undefined\nlast(undefined); // undefined\n```\n\n### [just-tail](https://www.npmjs.com/package/just-tail)\n[source](https://github.com/angus-c/just/tree/master/packages/array-tail)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-tail)\n\n```shell\nnpm install just-tail\n```\n```shell\nyarn add just-tail\n```\n\nReturn all but the first element of an array\n\n```js\nimport tail from 'just-tail';\n\ntail([1, 2, 3, 4, 5]); // [2, 3, 4, 5]\ntail([{a: 1}, {b: 1}, {c: 1}]); // [{b: 1}, {c: 1}]\ntail([true, false, [true, false]]); // [false, [true, false]]\ntail([]); // []\ntail(); // undefined\ntail(null); // undefined\ntail(undefined); // undefined\n```\n\n### [just-random](https://www.npmjs.com/package/just-random)\n[source](https://github.com/angus-c/just/tree/master/packages/array-random)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-random)\n\n```shell\nnpm install just-random\n```\n```shell\nyarn add just-random\n```\n\nReturn a randomly selected element in an array\n\n```js\nimport random from 'just-random';\n\nrandom([1, 2, 3]);\n// one of [1, 2, 3], at random\n```\n\n### [just-shuffle](https://www.npmjs.com/package/just-shuffle)\n[source](https://github.com/angus-c/just/tree/master/packages/array-shuffle)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-shuffle)\n\n```shell\nnpm install just-shuffle\n```\n```shell\nyarn add just-shuffle\n```\n\nReturn the elements of an array in random order\n\n```js\nimport shuffle from 'just-shuffle';\n\nshuffle([1, 2, 3]); \n// array with original elements randomly sorted\nshuffle([1, 2, 3], {shuffleAll: true}); \n// array with original elements randomly sorted and all in new postions\nshuffle([]); // []\nshuffle([1]); // [1]\nshuffle(); // throws\nshuffle(undefined); // throws\nshuffle(null); // throws\nshuffle({}); // throws\n```\n\n### [just-split](https://www.npmjs.com/package/just-split)\n[source](https://github.com/angus-c/just/tree/master/packages/array-split)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-split)\n\n```shell\nnpm install just-split\n```\n```shell\nyarn add just-split\n```\n\nSplits array into groups of n items each\n\n```js\nimport split from 'just-split';\n\nsplit([]); // []\nsplit([1, 2, 3, 4, 5]); // [[1, 2, 3, 4, 5]]\nsplit([1, 2, 3, 4, 5, 6, 7, 8, 9], 3); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nsplit([1, 2, 3, 4, 5, 6, 7, 8, 9], '3'); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nsplit(['a', 'b', 'c', 'd', 'e'], 2); // [['a', 'b'], ['c', 'd'], ['e']]\nsplit([1, 2, 3, 4, 5, 6, 7, 8], 3); // [[1, 2, 3], [4, 5, 6], [7, 8]]\n```\n\n### [just-split-at](https://www.npmjs.com/package/just-split-at)\n[source](https://github.com/angus-c/just/tree/master/packages/array-split-at)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-split-at)\n\n```shell\nnpm install just-split-at\n```\n```shell\nyarn add just-split-at\n```\n\nSplits an array into two at a given position\n\n```js\nimport splitAt from 'just-split-at';\n\nsplitAt([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4, 5]]\nsplitAt([{a: 1}, {b: 1}, {c: 1}], -1); // [[{a: 1}, {b: 1}], [{c: 1}]]\nsplitAt([], 2); // [[], []]\nsplitAt(null, 1); // throws\nsplitAt(undefined, 1); // throws\n```\n\n### [just-order-by](https://www.npmjs.com/package/just-order-by)\n[source](https://github.com/angus-c/just/tree/master/packages/array-order-by)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-order-by)\n\n```shell\nnpm install just-order-by\n```\n```shell\nyarn add just-order-by\n```\n\nProduces a new array, sorted in given order\n\n```js\nimport orderBy from 'just-order-by';\n\norderBy([10, 1, 5, 20, 15, 35, 30, 6, 8]); // [1, 5, 6, 8, 10, 15, 20, 30, 35]\n\norderBy(\n  [\n    { user: 'fabio', details: { city: 'Milan', age: 34 } },\n    { user: 'max', details: { city: 'Munich', age: 29 } },\n    { user: 'zacarias', details: { city: 'Sao Paulo', age: 44 } },\n    { user: 'robert', details: { city: 'Manchester', age: 28 } },\n    { user: 'max', details: { city: 'Zurich', age: 38 } },\n  ],\n  [\n    {\n      property(v) {\n        return v.details.age;\n      },\n    },\n  ]\n);\n\n/*\n[\n  {user: 'robert', age: 28},\n  {user: 'max', age: 29},\n  {user: 'fabio', age: 34},\n  {user: 'klaus', age: 38},\n  {user: 'zacarias', age: 44},\n]\n*/\n\norderBy(\n  [\n    {user: 'fabio', age: 34},\n    {user: 'max', age: 29},\n    {user: 'zacarias', age: 44},\n    {user: 'robert', age: 28},\n    {user: 'klaus', age: 38},\n  ],\n  [\n    {\n      property: 'user',\n    },\n  ]\n);\n\n/*\n[\n  {user: 'fabio', age: 34},\n  {user: 'klaus', age: 38},\n  {user: 'max', age: 29},\n  {user: 'robert', age: 28},\n  {user: 'zacarias', age: 44},\n]\n*/\n\norderBy(\n  [\n    { user: 'fabio', age: 34 },\n    { user: 'max', age: 29 },\n    { user: 'zacarias', age: 44 },\n    { user: 'moris', age: 28 },\n    { user: 'max', age: 38 },\n  ],\n  [\n    {\n      property: 'user',\n      order: 'desc',\n    },\n    {\n      property(v) {\n        return v.age;\n      },\n    },\n  ]\n);\n\n/*\n[\n  {\n    user: 'zacarias',\n    age: 44\n  },\n  {\n    user: 'moris',\n    age: 28\n  },\n  {\n    user: 'max',\n    age: 29\n  },\n  {\n    user: 'max',\n    age: 38\n  },\n  {\n    user: 'fabio',\n    age: 34\n  }\n]\n*/\n```\n\n### [just-sort-by](https://www.npmjs.com/package/just-sort-by)\n[source](https://github.com/angus-c/just/tree/master/packages/array-sort-by)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-sort-by)\n\n```shell\nnpm install just-sort-by\n```\n```shell\nyarn add just-sort-by\n```\n\nProduces a new array, sorted in ascending order\n\n```js\nimport sortBy from 'just-sort-by';\n\nsortBy([10, 1, 5, 20, 15, 35, 30, 6, 8]); // [1, 5, 6, 8, 10, 15, 20, 30, 35]\n\nsortBy([\n  {user: 'fabio', details: {city: \"Milan\", age: 34}},\n  {user: 'max', details: {city: \"Munich\", age: 29}},\n  {user: 'zacarias', details: {city: \"Sao Paulo\", age: 44}},\n  {user: 'robert', details: {city: \"Manchester\", age: 28}},\n  {user: 'klaus', details: {city: \"Zurich\", age: 38}},\n], function(o) {\n  return o.details.age;\n});\n\n/*\n[\n  {user: 'robert', age: 28},\n  {user: 'max', age: 29},\n  {user: 'fabio', age: 34},\n  {user: 'klaus', age: 38},\n  {user: 'zacarias', age: 44},\n]\n*/\n\nsortBy([\n  {user: 'fabio', age: 34},\n  {user: 'max', age: 29},\n  {user: 'zacarias', age: 44},\n  {user: 'robert', age: 28},\n  {user: 'klaus', age: 38},\n], 'user');\n/*\n[\n  {user: 'fabio', age: 34},\n  {user: 'klaus', age: 38},\n  {user: 'max', age: 29},\n  {user: 'robert', age: 28},\n  {user: 'zacarias', age: 44},\n]\n*/\n```\n\n### [just-partition](https://www.npmjs.com/package/just-partition)\n[source](https://github.com/angus-c/just/tree/master/packages/array-partition)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-partition)\n\n```shell\nnpm install just-partition\n```\n```shell\nyarn add just-partition\n```\n\nElements satisfying predicate added to first array, remainder added to second\n\n```js\nimport partition from 'just-partition';\n\npartition([1, 5, 2, 4, 3], n =\u003e n \u003e 3); // [[5, 4],[1, 2, 3]]\npartition(['a', 2, 3, '3'], x =\u003e typeof x == 'string'); // [['a', '3'],[2, 3]]\npartition([1, 2, 3, 4], x =\u003e typeof x == 'number'); // [[1, 2, 3, 4],[]]\npartition([1, 2, 3, 4], x =\u003e typeof x == 'string'); // [[], [1, 2, 3, 4]]\npartition([], n =\u003e n \u003e 3); // [[], []]\npartition({a: 1, b: 2}, n =\u003e n \u003e 1); // throws\npartition(null, n =\u003e n \u003e 1); // throws\npartition(undefined, n =\u003e n \u003e 1); // throws\n```\n\n### [just-permutations](https://www.npmjs.com/package/just-permutations)\n[source](https://github.com/angus-c/just/tree/master/packages/array-permutations)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-permutations)\n\n```shell\nnpm install just-permutations\n```\n```shell\nyarn add just-permutations\n```\n\nReturns all permutations of the length N of the elements of the given Array\n\n```js\nimport permutations from 'just-permutations';\n\npermutations([1, 2, 3]); // [[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]\npermutations([]); // []\npermutations(); // throws\n```\n\n### [just-range](https://www.npmjs.com/package/just-range)\n[source](https://github.com/angus-c/just/tree/master/packages/array-range)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-range)\n\n```shell\nnpm install just-range\n```\n```shell\nyarn add just-range\n```\n\nGenerate a range array for numbers\n\n```js\nimport range from 'just-range';\n\nrange(1, 5); // [1, 2, 3, 4]\nrange(5); // [0, 1, 2, 3, 4]\nrange(-5); // [0, -1, -2, -3, -4]\nrange(0, 20, 5) // [0, 5, 10, 15]\n```\n\n### [just-remove](https://www.npmjs.com/package/just-remove)\n[source](https://github.com/angus-c/just/tree/master/packages/array-remove)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-remove)\n\n```shell\nnpm install just-remove\n```\n```shell\nyarn add just-remove\n```\n\nRemoves one array from another\n\n```js\nimport remove from 'just-remove';\n\nremove([1, 2, 3, 4, 5, 6], [1, 3, 6]); // [2, 4, 5]\n```\n\n### [just-union](https://www.npmjs.com/package/just-union)\n[source](https://github.com/angus-c/just/tree/master/packages/array-union)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-union)\n\n```shell\nnpm install just-union\n```\n```shell\nyarn add just-union\n```\n\nReturns the union of two arrays\n\n```js\nimport union from 'just-union';\n\nunion([1, 2, 5, 6], [2, 3, 4, 6]); // [1, 2, 5, 6, 3, 4]\n```\n\n### [just-zip-it](https://www.npmjs.com/package/just-zip-it)\n[source](https://github.com/angus-c/just/tree/master/packages/array-zip)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-zip-it)\n\n```shell\nnpm install just-zip-it\n```\n```shell\nyarn add just-zip-it\n```\n\nReturns an array of grouped elements, taking n-th element from every given array\n\n```js\nimport zip from 'just-zip-it';\n\nzip([1, 2, 3]); // [[1], [2], [3]]\nzip([1, 2, 3], ['a', 'b', 'c']); // [[1, 'a'], [2, 'b'], [3, 'c']]\nzip([1, 2], ['a', 'b'], [true, false]); //[[1, 'a', true], [2, 'b', false]]\n\nzip(undefined, {}, false, 1, 'foo'); // []\nzip([1, 2], ['a', 'b'], undefined, {}, false, 1, 'foo'); // [[1, 'a'], [2, 'b']]\n\nzip([1, 2, 3], ['a', 'b'], [true]); // [[1, 'a', true], [2, 'b', undefined], [3, undefined, undefined]]\n```\n\n### [just-group-by](https://www.npmjs.com/package/just-group-by)\n[source](https://github.com/angus-c/just/tree/master/packages/array-group-by)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-group-by)\n\n```shell\nnpm install just-group-by\n```\n```shell\nyarn add just-group-by\n```\n\nReturn a grouped object from array\n\n```js\nimport groupBy from 'just-group-by';\n\ngroupBy([6.1, 4.2, 6.3], Math.floor); // { '4': [4.2], '6': [6.1, 6.3] }\ngroupBy([1,2,3,4,5,6,7,8], function(i) { return i % 2}); // { '0': [2, 4, 6, 8], '1': [1, 3, 5, 7] }\n```\n\n### Statistics\n\n### [just-mean](https://www.npmjs.com/package/just-mean)\n[source](https://github.com/angus-c/just/tree/master/packages/array-mean)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-mean)\n\n```shell\nnpm install just-mean\n```\n```shell\nyarn add just-mean\n```\n\nThe mean (average) value in an array\n\n```js\nimport mean from 'just-mean';\n\nmean([1, 2, 3, 2, 4, 1]); // 2.1666666667\nmean(3, 2, 1); // 2\nmean([4]); // 4\nmean(['3', 2]); // throws\nmean(); // throws\n```\n\n### [just-median](https://www.npmjs.com/package/just-median)\n[source](https://github.com/angus-c/just/tree/master/packages/array-median)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-median)\n\n```shell\nnpm install just-median\n```\n```shell\nyarn add just-median\n```\n\nReturn the median value of an array of numbers\n\n```js\nimport median from 'just-median';\n\nmedian([1, 2, 3, 4, 5]); // 3\nmedian([3, -1, 2]); // 2\nmedian([9, 14, 14, 200, 15]); // 14\nmedian(1, 2, 4, 3); // 2.5\nmedian(['3', 2, 1]); // throws\nmedian(); // throws\n```\n\n### [just-mode](https://www.npmjs.com/package/just-mode)\n[source](https://github.com/angus-c/just/tree/master/packages/array-mode)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-mode)\n\n```shell\nnpm install just-mode\n```\n```shell\nyarn add just-mode\n```\n\nReturn the most frequently occuring number(s)\n\n```js\nimport mode from 'just-mode';\n\nmode([1, 2, 3, 2]); // 2\nmode(4, 4, 1, 4); // 4\nmode(100, 100, 101, 101); // [100, 101]\nmode(4, 3, 2, 1); // [1, 2, 3, 4]\nmode(['1', 2, 2, 1, 2]); // throws\nmode(null); // throws\n```\n\n### [just-percentile](https://www.npmjs.com/package/just-percentile)\n[source](https://github.com/angus-c/just/tree/master/packages/array-percentile)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-percentile)\n\n```shell\nnpm install just-percentile\n```\n```shell\nyarn add just-percentile\n```\n\nReturn the value at the given percentile (using linear interpolation)\n\n```js\nimport percentile from 'just-percentile';\n\npercentile([1, 2, 3], 0); // 1\npercentile([1, 2, 3], 0.5); // 2\npercentile([1, 2, 3], 1); // 3\n\n// See https://en.wikipedia.org/wiki/Percentile (linear interpolation method)\npercentile([15, 20, 35, 40, 50], 0.05); // 15\npercentile([15, 20, 35, 40, 50], 0.3); // 20\npercentile([15, 20, 35, 40, 50], 0.4); // 27.5\npercentile([15, 20, 35, 40, 50], 0.95); // 50\n\npercentile(1, 2, 3, 50); // throws\npercentile(['1', 2, 3], 50); // throws\npercentile([], 50); // throws\n```\n\n### [just-variance](https://www.npmjs.com/package/just-variance)\n[source](https://github.com/angus-c/just/tree/master/packages/array-variance)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-variance)\n\n```shell\nnpm install just-variance\n```\n```shell\nyarn add just-variance\n```\n\nReturn the standard deviation of an array or numeric argument list\n\n```js\nimport variance from 'just-variance';\n\nvariance([1, 2, 3, 2, 4, 1]); // 1.3666666667\nvariance(3, 2, 1); // 1\nvariance([100, 100, 100.1, 100]); // 0.0025\nvariance(1, 2, 3, 4, 5, -6); // 15.5\nvariance([4]); // throws\nvariance(['3', 2]); // throws\nvariance(NaN, NaN); // throws\nvariance(); // throws\n```\n\n### [just-standard-deviation](https://www.npmjs.com/package/just-standard-deviation)\n[source](https://github.com/angus-c/just/tree/master/packages/array-standard-deviation)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-standard-deviation)\n\n```shell\nnpm install just-standard-deviation\n```\n```shell\nyarn add just-standard-deviation\n```\n\nReturn the standard deviation of an array or numeric argument list\n\n```js\nimport standardDeviation from \"just-standard-deviation\";\n\nstandardDeviation([1, 2, 3, 2, 4, 1]); // 1.16904519\nstandardDeviation(3, 2, 1); // 1\nstandardDeviation([100, 100, 100.1, 100]); // 0.05\nstandardDeviation(1, 2, 3, 4, 5, -6); // 3.9370039\nstandardDeviation([4]); // throws\nstandardDeviation([\"3\", 2]); // throws\nstandardDeviation(NaN, NaN); // throws\nstandardDeviation(); // throws\n```\n\n### [just-skewness](https://www.npmjs.com/package/just-skewness)\n[source](https://github.com/angus-c/just/tree/master/packages/array-skewness)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-skewness)\n\n```shell\nnpm install just-skewness\n```\n```shell\nyarn add just-skewness\n```\n\nReturn the skewness of an array or numeric argument list using Pearson's second skewness coefficient\n\n```js\nimport skewness from \"just-skewness\";\n\n// Using Pearson's second skewness coefficient\nskewness(3, 2, 1); // 0\nskewness([1, 2, 3, 2, 4, 1]); // 0.4276994613841504\nskewness(1, 2, 3, 4, 5, -6); // -0.762000762001143\nskewness([1, 2, 3, 4, 9]); // 0.7705935588815224\nskewness([4]); // throws\nskewness([\"3\", 2]); // throws\nskewness(NaN, NaN); // throws\nskewness(); // throws\n```\n\n### Strings\n\n### [just-template](https://www.npmjs.com/package/just-template)\n[source](https://github.com/angus-c/just/tree/master/packages/string-template)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-template)\n\n```shell\nnpm install just-template\n```\n```shell\nyarn add just-template\n```\n\nInterpolate a string with variables\n\n```js\nimport template from 'just-template';\n\nvar data = {\n  a: {\n    aa: {\n      aaa: 'apple',\n      bbb: 'pear'\n    },\n    bb: 'orange'\n  },\n  b: 'plum'\n};\ntemplate('2 {{a.aa.aaa}}s, a {{a.aa.bbb}}, 3 {{a.bb}}s and a {{b}}. Yes 1 {{a.aa.bbb}}.', data);\n// '2 apples, a pear, 3 oranges and a plum. Yes 1 pear.'\n```\n\n### [just-truncate](https://www.npmjs.com/package/just-truncate)\n[source](https://github.com/angus-c/just/tree/master/packages/string-truncate)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-truncate)\n\n```shell\nnpm install just-truncate\n```\n```shell\nyarn add just-truncate\n```\n\nTruncate a string with a custom suffix\n\n```js\n  truncate('when shall we three meet again', 9); // 'when s...'\n  truncate('when shall we three meet again', 10, ' (etc)'); // 'when (etc)'\n  truncate('when shall we', 15,); // 'when shall we'\n  truncate('when shall we', 15, '(more)'); // 'when shall we'\n  truncate('when shall we', 10, ' (etc etc etc)'); // ' (etc etc etc)'\n```\n\n### [just-prune](https://www.npmjs.com/package/just-prune)\n[source](https://github.com/angus-c/just/tree/master/packages/string-prune)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-prune)\n\n```shell\nnpm install just-prune\n```\n```shell\nyarn add just-prune\n```\n\nPrune a string with whole words and a custom suffix\n\n```js\n  prune('when shall we three meet again', 7); // 'when...'\n  prune('when shall we three meet again', 7, ' (more)'; // 'when (more)'\n  prune('when shall we', 15,); // 'when shall we'\n  prune('when shall we', 15, ' (etc)'); // 'when shall we'\n  prune('when shall we', 7, ' (more)'); // ' (more)'\n```\n\n### [just-squash](https://www.npmjs.com/package/just-squash)\n[source](https://github.com/angus-c/just/tree/master/packages/string-squash)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-squash)\n\n```shell\nnpm install just-squash\n```\n```shell\nyarn add just-squash\n```\n\nRemove all spaces from a string, optionally remove escape sequences too\n\n```js\n  squash('the cat sat on the mat'); // 'thecatsatonthemat'\n  squash(' the cat sat on the mat '); // 'thecatsatonthemat'\n  squash('\\tthe cat\\n sat \\fon \\vthe \\rmat '); // '\\tthecat\\nsat\\fon\\vthe\\rmat'\n  squash('\\tthe cat\\n sat \\fon \\vthe \\rmat ', true); // 'thecatsatonthemat'\n  squash(`the cat\nsat on the mat`, true); // thecatsatonthemat\n```\n\n### [just-left-pad](https://www.npmjs.com/package/just-left-pad)\n[source](https://github.com/angus-c/just/tree/master/packages/string-left-pad)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-left-pad)\n\n```shell\nnpm install just-left-pad\n```\n```shell\nyarn add just-left-pad\n```\n\nAdd characters to the left of a string such that its total length is n\n\n```js\nimport leftPad from 'just-left-pad';\n\nleftPad('hello', 9); // '    hello'\nleftPad('hello', 3); // 'hello'\nleftPad('hello', 9, '.'); // '....hello'\nleftPad('hello', 9, '..'); // '....hello'\nleftPad('hello', 10, 'ab'); // 'bababhello'\nleftPad('hello', 9, '\\uD83D\\uDC04'); // '🐄🐄🐄🐄hello'\nleftPad('hello', 10, '\\uD83D\\uDC11\\uD83D\\uDC04'), // '🐄🐑🐄🐑🐄hello'\nleftPad('hello', 7, '🐄'), // '🐄🐄hello'\nleftPad(null, 7); // throws\nleftPad([], 4, '*'); // throws\nleftPad('hello', 4, true); // throws\nleftPad('hello', -4, true); // throws  \nleftPad('hello', 2.3, true); // throws    \n```\n\n### [just-right-pad](https://www.npmjs.com/package/just-right-pad)\n[source](https://github.com/angus-c/just/tree/master/packages/string-right-pad)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-right-pad)\n\n```shell\nnpm install just-right-pad\n```\n```shell\nyarn add just-right-pad\n```\n\nAdd characters to the right of a string such that its total length is n\n\n```js\nimport rightPad from 'just-right-pad';\n\nrightPad('hello', 9); // 'hello    '\nrightPad('hello', 3); // 'hello'\nrightPad('hello', 9, '.'); // 'hello....'\nrightPad('hello', 9, '..'); // 'hello....'\nrightPad('hello', 10, 'ab'); // 'helloababa'\nrightPad('hello', 9, '\\uD83D\\uDC04'); // 'hello🐄🐄🐄🐄'\nrightPad('hello', 10, '\\uD83D\\uDC11\\uD83D\\uDC04'), // 'hello🐑🐄🐑🐄🐑'\nrightPad('hello', 7, '🐄'), // 'hello🐄🐄'\nrightPad(null, 7); // throws\nrightPad([], 4, '*'); // throws\nrightPad('hello', 4, true); // throws\nrightPad('hello', -4, true); // throws  \nrightPad('hello', 2.3, true); // throws    \n```\n\n### [just-camel-case](https://www.npmjs.com/package/just-camel-case)\n[source](https://github.com/angus-c/just/tree/master/packages/string-camel-case)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-camel-case)\n\n```shell\nnpm install just-camel-case\n```\n```shell\nyarn add just-camel-case\n```\n\nConvert a string to camel case\n\n```js\n  import camelCase from 'just-camel-case';\n\n  camelCase('the quick brown fox'); // 'theQuickBrownFox'\n  camelCase('the_quick_brown_fox'); // 'theQuickBrownFox'\n  camelCase('the-quick-brown-fox'); // 'theQuickBrownFox'\n  camelCase('theQuickBrownFox'); // 'theQuickBrownFox'\n  camelCase('thequickbrownfox'); // 'thequickbrownfox'\n  camelCase('the - quick * brown# fox'); // 'theQuickBrownFox'\n  camelCase('behold theQuickBrownFox'); // 'beholdTheQuickBrownFox'\n  camelCase('Behold theQuickBrownFox'); // 'beholdTheQuickBrownFox'\n  // all caps words are camel-cased\n  camelCase('The quick brown FOX'), 'theQuickBrownFox');\n  // all caps substrings \u003e= 4 chars are camel-cased\n  camelCase('theQUickBrownFox'); // 'theQUickBrownFox'\n  camelCase('theQUIckBrownFox'); // 'theQUIckBrownFox'\n  camelCase('theQUICKBrownFox'); // 'theQuickBrownFox'\n```\n\n### [just-kebab-case](https://www.npmjs.com/package/just-kebab-case)\n[source](https://github.com/angus-c/just/tree/master/packages/string-kebab-case)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-kebab-case)\n\n```shell\nnpm install just-kebab-case\n```\n```shell\nyarn add just-kebab-case\n```\n\nConvert a string to kebab case\n\n```js\n  import kebabCase from 'just-kebab-case';\n\n  kebabCase('the quick brown fox'); // 'the-quick-brown-fox'\n  kebabCase('the-quick-brown-fox'); // 'the-quick-brown-fox'\n  kebabCase('the_quick_brown_fox'); // 'the-quick-brown-fox'\n  kebabCase('theQuickBrownFox'); // 'the-quick-brown-fox'\n  kebabCase('theQuickBrown Fox'); // 'the-quick-brown-fox'\n  kebabCase('thequickbrownfox'); // 'thequickbrownfox'\n  kebabCase('the - quick * brown# fox'); // 'the-quick-brown-fox'\n  kebabCase('theQUICKBrownFox'); // 'the-q-u-i-c-k-brown-fox'\n```\n\n### [just-snake-case](https://www.npmjs.com/package/just-snake-case)\n[source](https://github.com/angus-c/just/tree/master/packages/string-snake-case)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-snake-case)\n\n```shell\nnpm install just-snake-case\n```\n```shell\nyarn add just-snake-case\n```\n\nConvert a string to snake case\n\n```js\n  import snakeCase from 'just-snake-case';\n\n  snakeCase('the quick brown fox'); // 'the_quick_brown_fox'\n  snakeCase('the-quick-brown-fox'); // 'the_quick_brown_fox'\n  snakeCase('the_quick_brown_fox'); // 'the_quick_brown_fox'\n  snakeCase('theQuickBrownFox'); // 'the_quick_brown_fox'\n  snakeCase('thequickbrownfox'); // 'thequickbrownfox'\n  snakeCase('the - quick * brown# fox'); // 'the_quick_brown_fox'\n  snakeCase('theQUICKBrownFox'); // 'the_q_u_i_c_k_brown_fox'\n```\n\n### [just-pascal-case](https://www.npmjs.com/package/just-pascal-case)\n[source](https://github.com/angus-c/just/tree/master/packages/string-pascal-case)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-pascal-case)\n\n```shell\nnpm install just-pascal-case\n```\n```shell\nyarn add just-pascal-case\n```\n\nConvert a string to pascal case\n\n```js\n  import pascalCase from 'just-pascal-case';\n\n  pascalCase('the quick brown fox'); // 'TheQuickBrownFox'\n  pascalCase('the_quick_brown_fox'); // 'TheQuickBrownFox'\n  pascalCase('the-quick-brown-fox'); // 'TheQuickBrownFox'\n  pascalCase('theQuickBrownFox'); // 'TheQuickBrownFox'\n  pascalCase('thequickbrownfox'); // 'Thequickbrownfox'\n  pascalCase('the - quick * brown# fox'); // 'TheQuickBrownFox'\n  pascalCase('theQUICKBrownFox'); // 'TheQUICKBrownFox'\n```\n\n### [just-capitalize](https://www.npmjs.com/package/just-capitalize)\n[source](https://github.com/angus-c/just/tree/master/packages/string-capitalize)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-capitalize)\n\n```shell\nnpm install just-capitalize\n```\n```shell\nyarn add just-capitalize\n```\n\nCapitalize the first character of a string\n\n```js\n  import capitalize from 'just-capitalize';\n\n/*\n  capitalize('capitals'); // 'Capitals'\n  capitalize('Capitals'); // 'Capitals'\n  capitalize('many words'); // 'Many words'\n  capitalize('!exclaim'); // '!exclaim'\n*/\n```\n\n### [just-replace-all](https://www.npmjs.com/package/just-replace-all)\n[source](https://github.com/angus-c/just/tree/master/packages/string-replace-all)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-replace-all)\n\n```shell\nnpm install just-replace-all\n```\n```shell\nyarn add just-replace-all\n```\n\nReplace all occurrences of a string within a string with another string\n\n```js\n  import replaceAll from 'just-replace-all';\n\n/*\n  replaceAll('hello, world', 'l', 'q'); // 'heqqo, worqd'\n  replaceAll('hello, world', 'l', 'qq'); // 'heqqqqo, worqqd'\n  replaceAll('hello, world', 'll', 'q'); // 'heqo, world'\n  replaceAll('hello, world', '', 'q'); // 'hello, world'\n  replaceAll('hello, world', 'l', ''); // 'heo, word'\n  replaceAll('hello, world', null, 'q'); // 'hello, world'\n  replaceAll('hello, world', 'l'); // throw\n  replaceAll('hello, world'); // throw\n  replaceAll(); // throw\n  replaceAll(null, 'l', 'q'); // throw\n  replaceAll('hello, world', null, 'q'); // throw\n  replaceAll('hello, world', 'l', null); // throw\n*/\n```\n\n### Numbers\n\n### [just-clamp](https://www.npmjs.com/package/just-clamp)\n[source](https://github.com/angus-c/just/tree/master/packages/number-clamp)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-clamp)\n\n```shell\nnpm install just-clamp\n```\n```shell\nyarn add just-clamp\n```\n\nRestrict a number within a range\n\n```js\nimport clamp from 'just-clamp';\n\nvar n = 5;\nclamp(1, n, 12); // 5\nclamp(3, n, 1); // 3\nclamp(8, n, 9); // 8\nclamp(0, n, 0); // 0\n\nvar n = -5;\nclamp(1, n, 12); // 1\nclamp(-7, n, -8); // -7\n\nclamp(NaN, n, 8); // NaN\nclamp(3, n, NaN); // NaN  \nclamp(3, NaN, 8); // NaN    \n\nclamp(undefined, n, 8); // throws\nclamp(3, n, 'h'); // throws  \nclamp(3, false, 8); // throws \n```\n\n### [just-is-prime](https://www.npmjs.com/package/just-is-prime)\n[source](https://github.com/angus-c/just/tree/master/packages/number-is-prime)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-is-prime)\n\n```shell\nnpm install just-is-prime\n```\n```shell\nyarn add just-is-prime\n```\n\nCheck if number is prime\n\n```js\n  import isPrime from 'just-is-prime;\n\n/*\n  isPrime(1); // false\n  isPrime(2); // true\n  isPrime(17); // true\n  isPrime(10); // false\n  isPrime(); // throws\n  isPrime(null); // throws\n  isPrime(\"js\"); // throws\n  isPrime({}); // throws\n  isPrime(function() {}); // throws\n  isPrime([]); // throws\n*/\n```\n\n### [just-modulo](https://www.npmjs.com/package/just-modulo)\n[source](https://github.com/angus-c/just/tree/master/packages/number-modulo)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-modulo)\n\n```shell\nnpm install just-modulo\n```\n```shell\nyarn add just-modulo\n```\n\nModulo of a number and a divisor\n\n```js\nimport modulo from 'just-modulo';\n\nmodulo(7, 5); // 2\nmodulo(17, 23); // 17\nmodulo(16.2, 3.8); // 1\nmodulo(5.8, 3.4); //2.4\nmodulo(4, 0); // 4\nmodulo(-7, 5); // 3\nmodulo(-2, 15); // 13\nmodulo(-5.8, 3.4); // 1\nmodulo(12, -1); // NaN\nmodulo(-3, -8); // NaN\nmodulo(12, 'apple'); // NaN\nmodulo('bee', 9); // NaN\nmodulo(null, undefined); // NaN\n```\n\n### [just-random-integer](https://www.npmjs.com/package/just-random-integer)\n[source](https://github.com/angus-c/just/tree/master/packages/number-random-integer)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-random-integer)\n\n```shell\nnpm install just-random-integer\n```\n```shell\nyarn add just-random-integer\n```\n\nProduces a random integer within a given range\n\n```js\nimport random from 'just-random-integer';\n\nrandom();\n// Returns either 0 or 1\nrandom(5);\n// Returns a random integer between 0 and 5 (inclusively)\nrandom(3, 10);\n// Returns a random integer between 3 and 10 (inclusively)\nrandom(-5.8, 10.4);\n// Returns a random integer between -5 and 10 (inclusively)\n```\n\n### Functions\n\n### [just-compose](https://www.npmjs.com/package/just-compose)\n[source](https://github.com/angus-c/just/tree/master/packages/function-compose)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-compose)\n\n```shell\nnpm install just-compose\n```\n```shell\nyarn add just-compose\n```\n\nReturn a function composed of 2 or more functions\n\n```js\nimport compose from 'just-compose';\n\nconst sqRootBiggest = compose(Math.max, Math.sqrt, Math.trunc);\nsqRootBiggest(10, 5); // 3\nsqRootBiggest(7, 0, 16); // 4\n```\n\n### [just-curry-it](https://www.npmjs.com/package/just-curry-it)\n[source](https://github.com/angus-c/just/tree/master/packages/function-curry)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-curry-it)\n\n```shell\nnpm install just-curry-it\n```\n```shell\nyarn add just-curry-it\n```\n\nReturn a curried function\n\n```js\nimport curry from 'just-curry-it';\n\nfunction add(a, b, c) {\n  return a + b + c;\n}\ncurry(add)(1)(2)(3); // 6\ncurry(add)(1)(2)(2); // 5\ncurry(add)(2)(4, 3); // 9\n\nfunction add(...args) {\n  return args.reduce((sum, n) =\u003e sum + n, 0)\n}\nvar curryAdd4 = curry(add, 4)\ncurryAdd4(1)(2, 3)(4); // 10\n\nfunction converter(ratio, input) {\n  return (input*ratio).toFixed(1);\n}\nconst curriedConverter = curry(converter)\nconst milesToKm = curriedConverter(1.62);\nmilesToKm(35); // 56.7\nmilesToKm(10); // 16.2\n```\n\n### [just-demethodize](https://www.npmjs.com/package/just-demethodize)\n[source](https://github.com/angus-c/just/tree/master/packages/function-demethodize)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-demethodize)\n\n```shell\nnpm install just-demethodize\n```\n```shell\nyarn add just-demethodize\n```\n\nTurn a method into a standalone function; the first arg becomes `this`\n\n```js\nimport demethodize from 'just-demethodize';\n\nconst trimFn = demethodize(''.trim);\n['hello ', ' goodbye', 'hello again'].map(trimFn); // ['hello', 'goodbye', 'hello again']\n```\n\n### [just-flip](https://www.npmjs.com/package/just-flip)\n[source](https://github.com/angus-c/just/tree/master/packages/function-flip)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-flip)\n\n```shell\nnpm install just-flip\n```\n```shell\nyarn add just-flip\n```\n\nFlip first two arguments of a function\n\n```js\nimport flip from 'just-flip';\n\nflip(console.log)(1, 2, 3) // 2, 1, 3\n\nimport map from 'just-map-object';\nimport partial from 'just-partial';\n\nconst numbers = {x: 5, y: 10};\nconst flippedMap = flip(map);\nconst double = partial(flippedMap, (undefined, number) =\u003e number * 2);\ndouble(numbers) // {x: 10, y: 20];\n```\n\n### [just-partial-it](https://www.npmjs.com/package/just-partial-it)\n[source](https://github.com/angus-c/just/tree/master/packages/function-partial)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-partial-it)\n\n```shell\nnpm install just-partial-it\n```\n```shell\nyarn add just-partial-it\n```\n\nReturn a partial function\n\n```js\nimport partial from 'just-partial-it';\n\nconst cubedRoot = partial(Math.pow, _, 1/3);\ncubedRoot(64); // 4\n\nconst getRoot = partial(Math.pow, 64);\ngetRoot(1/2); // 8\n```\n\n### [just-pipe](https://www.npmjs.com/package/just-pipe)\n[source](https://github.com/angus-c/just/tree/master/packages/function-pipe)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-pipe)\n\n```shell\nnpm install just-pipe\n```\n```shell\nyarn add just-pipe\n```\n\nPass a value through a pipeline of functions\n\n```js\nimport pipe from 'just-pipe\n\npipe(3, a =\u003e a+1, b =\u003e b*2) // 8\npipe('John Smith', a =\u003e a.split(' '), b =\u003e b.reverse(), c =\u003e c[0]) // 'Smith'\n```\n\n### [just-debounce-it](https://www.npmjs.com/package/just-debounce-it)\n[source](https://github.com/angus-c/just/tree/master/packages/function-debounce)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-debounce-it)\n\n```shell\nnpm install just-debounce-it\n```\n```shell\nyarn add just-debounce-it\n```\n\nReturn a debounced function\n\n```js\nimport debounce from \"just-debounce-it\";\n\nconst fn1 = debounce(() =\u003e console.log(\"Hello\"), 500);\nfn1();\nfn1();\nfn1();\n// 500ms later logs 'hello' once\n\nconst fn2 = debounce(() =\u003e console.log(\"Hello\"), 500, true);\nfn2(); // logs hello immediately\nfn2();\nfn2();\n// 500ms later logs 'hello' once\n\nconst fn3 = debounce(() =\u003e console.log(\"Hello\"), 500);\nfn3();\nfn3();\nfn3();\nfn3.cancel();\n// function cancelled before 'hello' is logged\n\nconst fn4 = debounce(() =\u003e console.log(\"Hello\"), 500);\nfn4();\nfn4();\nfn4();\nfn4.flush();\n// immediately invoke the debounced function\n```\n\n### [just-memoize](https://www.npmjs.com/package/just-memoize)\n[source](https://github.com/angus-c/just/tree/master/packages/function-memoize)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-memoize)\n\n```shell\nnpm install just-memoize\n```\n```shell\nyarn add just-memoize\n```\n\nAn implementation of the memoize technique\n\n```js\nimport memoize from 'just-memoize';\n\nconst sumByOne = memoize(function(value) {\n  return value + 1;\n});\n\nsumByOne(10); // Returns value returned by the function\nsumByOne(10); // Cache hit!\n\nsumByOne(20); // Returns value returned by the function\nsumByOne(20); // Cache hit!\n\n// Custom cache key (key defaults to JSON stringified arguments)\nvar sum = memoize(function(a, b) {\n  return a + b;\n}, function(a, b) {\n  return `${a}-${b}`;\n});\n\nsum(10, 10); // Returns value returned by the function\nsum(10, 20); // Returns value returned by the function\nsum(10, 20); // Cache hit!\n```\n\n### [just-memoize-last](https://www.npmjs.com/package/just-memoize-last)\n[source](https://github.com/angus-c/just/tree/master/packages/function-memoize-last)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-memoize-last)\n\n```shell\nnpm install just-memoize-last\n```\n```shell\nyarn add just-memoize-last\n```\n\nA memoize implementation that only caches the most recent evaluation\n\n```js\nconst memoizeLast = require('just-memoize-last')\nconst compare = require('just-compare')\n\nconst maxValue = memoizeLast(function(arr) {\n  return Math.max(...arr)\n}, function(a, b) {\n  return compare(a, b)\n});\n\nmaxValue([1,2,3]) // 3\nmaxValue([1,2,3]) // cache hit!\nmaxValue([1,3,4]) // 4\nmaxValue([1,2,3]) // 3\n```\n\n### [just-random](https://www.npmjs.com/package/just-random)\n[source](https://github.com/angus-c/just/tree/master/packages/array-random)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-random)\n\n```shell\nnpm install just-random\n```\n```shell\nyarn add just-random\n```\n\nReturn a randomly selected element in an array\n\n```js\nimport random from 'just-random';\n\nrandom([1, 2, 3]);\n// one of [1, 2, 3], at random\n```\n\n### [just-throttle](https://www.npmjs.com/package/just-throttle)\n[source](https://github.com/angus-c/just/tree/master/packages/function-throttle)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-throttle)\n\n```shell\nnpm install just-throttle\n```\n```shell\nyarn add just-throttle\n```\n\nReturn a throttled function\n\n```js\nimport throttle from 'just-throttle';\n\n// no matter how many times the function is called, only invoke once within the given interval\n// options: \n// `leading`: invoke  before interval\n// `trailing`: invoke afer interval\n\nconst fn1 = throttle(() =\u003e console.log('hello'), 500, {leading: true});\nsetInterval(fn1, 400);\n// logs 'hello' immediately and then every 500ms\n\nconst fn2 = throttle(() =\u003e console.log('hello'), 500, {trailing: true});\nsetInterval(fn2, 400);\n// logs 'hello' after 500ms and then every 500ms\n\nconst fn3 = throttle(() =\u003e console.log('hello'), 500, {leading: true, trailing: true});\n// forces trailing to false\n\nconst fn4 = throttle(() =\u003e console.log('hello'), 500, { leading: false });\nfn4();\nfn4();\nfn4();\nfn4.cancel();\n// function cancelled before 'hello' is logged\n\nconst fn5 = throttle(() =\u003e console.log(\"Hello\"), 500);\nfn5();\nfn5();\nfn5();\nfn5.flush();\n// immediately invoke the throttled function\n```\n\n### [just-once](https://www.npmjs.com/package/just-once)\n[source](https://github.com/angus-c/just/tree/master/packages/function-once)\n\n[`🍦 Try it`](https://anguscroll.com/just/just-once)\n\n```shell\nnpm install just-once\n```\n```shell\nyarn add just-once\n```\n\nCreate a function that can only be invoked once\n\n```js\nimport once from 'just-once';\n\nconst fn = once(() =\u003e console.log('hello'));\n\nfn();\n// logs 'hello'\nfn();\n// does nothing\n```\n\n## Testing\n\nRun all tests as a single test suite with\n\n`npm run test`\n\nCross browser tests (via saucelabs) are in the [`sauce` branch](https://github.com/angus-c/just/tree/sauce)\n\n## Contribute!\n\nhttps://github.com/angus-c/just/blob/master/CONTRIBUTING.md\n","funding_links":[],"categories":["JavaScript","typescript","library","Framework agnostic packages","Generic Utilities"],"sub_categories":["General utilities","Reactive Programming"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangus-c%2Fjust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangus-c%2Fjust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangus-c%2Fjust/lists"}