{"id":13410817,"url":"https://github.com/tjmehta/101","last_synced_at":"2025-05-14T14:09:43.933Z","repository":{"id":15925292,"uuid":"18667134","full_name":"tjmehta/101","owner":"tjmehta","description":"A modern JS utility library","archived":false,"fork":false,"pushed_at":"2022-01-06T10:09:29.000Z","size":542,"stargazers_count":1547,"open_issues_count":21,"forks_count":74,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-11T18:38:53.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tjmehta.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-11T08:14:09.000Z","updated_at":"2025-05-04T18:14:08.000Z","dependencies_parsed_at":"2022-09-07T08:00:33.613Z","dependency_job_id":null,"html_url":"https://github.com/tjmehta/101","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjmehta%2F101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjmehta%2F101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjmehta%2F101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjmehta%2F101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tjmehta","download_url":"https://codeload.github.com/tjmehta/101/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160465,"owners_count":22024569,"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-07-30T20:01:09.511Z","updated_at":"2025-05-14T14:09:38.897Z","avatar_url":"https://github.com/tjmehta.png","language":"JavaScript","readme":"![101](http://i.imgur.com/MFrmMt6.png)\n===\n[![NPM](https://nodei.co/npm/101.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/101/)\n\n[![Build Status](https://travis-ci.org/tjmehta/101.svg?branch=master)](https://travis-ci.org/tjmehta/101)\n[![Coverage Status](https://coveralls.io/repos/tjmehta/101/badge.png)](https://coveralls.io/r/tjmehta/101)\n[![Dependency Status](https://david-dm.org/tjmehta/101.svg)](https://david-dm.org/tjmehta/101)\n[![devDependency Status](https://david-dm.org/tjmehta/101/dev-status.svg)](https://david-dm.org/tjmehta/101#info=devDependencies)\n\n# Why another JS util library?\n### 1) 101 will be maintained to minimize overlap with vanilla JS.\n* 101 utils are made to work well with vanilla JS methods.\n* 101 will only duplicate vanilla JS to provide Functional Programming paradigms, or if\nthe method is not available in a widely supported JS version (currently ES5).\n* Other libraries often duplicate a lot of ES5: forEach, map, reduce, filter, sort, and more.\n\n### 2) No need for custom builds.\n* With 101, import naturally, and what you use will be bundled.\n* Each util method is a module that can be required `require('101/\u003cutil\u003e')`.\n* Currently CommonJS (node, browserify, webpack, etc) is supported, I will add other module system support on request.\n* Other libraries can be large, and require manually creating custom builds when optimizing for size.\n\n### Why not release each as individual modules?\nI usually agree with this philosophy; however, while in practice, adherence to the module-pattern\ncan become quite annoying for micro-modules (like those in 101):\n* Micro-modules existance throughout a project can change very frequently, because of this one may find\nthemselves constantly updating their package.json (repeatedly adding and removing the same micro-modules).\n* Unbundling micro-modules can lead to projects with hundreds of dependencies which can be tedious to maintain.\n\n\n\n# Installation\n\n`npm install 101`\n\n# Usage\n\n## assign (aka extend)\n\nJust like ES6's `Object.assign`. Extend an object with any number of objects (returns original).\n\n```js\nvar assign = require('101/assign');\n\nvar target = { foo: 1 };\nvar source1 = { bar: 1 };\nvar source2 = { baz: 1 };\nassign(target, source1) // { foo: 1, bar: 1, baz: 1 } target extended with source objects\nassign(target, source1, source2) // { foo: 1, bar: 1, baz: 1 } target extended with source objects\n```\n\n## and\n\nFunctional version of `\u0026\u0026`. Works great with `array.reduce`.\n\n```js\nvar and = require('101/and');\n\nand(true, false); // false\nand(true, true);  // true\nand(true, \"foo\");  // \"foo\"\n```\n\n## apply\n\nFunctional version of `function.apply`.\nSupports partial functionality (great with array functions).\n\n```js\nvar apply = require('101/apply');\n[sum].map(apply(null, [1, 2, 3])); // [6] = [sum(1,2,3)] = [1+2+3]\nfunction sum () {  /* sums all arguments */ }\napply({ prop: 'val' })(function () { return this.prop; });  // 'val'\n```\n\n## bindAll\n\nBind methods in an object.\nYou can pass an array containing the name of the methods to bind as second\nargument or leave it empty to bind all the available methods.\n\n```js\nvar bindAll = require('101/bind-all');\nvar obj = {\n  init: function() {\n    this.on(this.handler);\n  },\n  on: function(handler) {\n    return handler();\n  },\n  handler: function() {\n    console.log(this.msg);\n  },\n  msg: 'Hello World'\n}\n\nobj.init(); // undefined\n\nbindAll(obj);\nobj.init(); // \"Hello World\"\n\nbindAll(obj, ['handler']);\nobj.init(); // \"Hello World\"\n```\n\n## clone\n\nIt's [clone](https://www.npmjs.org/package/clone) (Only exporting this bc it is used internal to 101)\n\n```js\nvar clone = require('101/clone');\nvar obj = {\n  foo: 1,\n  bar: 2\n};\n\nclone(obj); // { foo: 1, bar: 2 }\n```\n\n## compose\n\nFunctional composition method. Works great with `array.reduce`.\n\n```js\nvar compose = require('101/compose');\n\ncompose(isNaN, parseInt)('nope'); // isNaN(parseInt('nope')) // true\n```\n\n## converge\n\nConverges an array of functions into one. Works great with `compose`.\n\n```js\nvar converge = require('101/converge');\n\nconverge(mul, [add, sub])(6, 2); // mul(add(6, 2), sub(6, 2)) // (6+2) * (6-2) = 36\n\n[ {a: true, b: false}\n, {a: false, b: false}\n, {a: true, b: true}\n].filter(converge(and , [pluck(\"a\") , pluck(\"b\")])); // [{a: true, b: true}]\n\n[f, converge(g, [h, i]), j].reduce(compose); // f(g(h(j), i(j)))\n```\n\n## curry\n\nReturns a curried function.\n\n```js\nvar curry = require('101/curry');\n\nfunction add(a, b) { return a + b; }\n\nvar curriedAdd = curry(add);\nvar add2 = curriedAdd(2);\n\nadd2(6); // 8\nadd2(8); // 10\n\nfunction join() { return Array.prototype.slice.call(arguments).join(''); }\n\ncurry(join, 3)(1)(0)(1); // \"101\"\n```\n\n## defaults\n\nFill non-existing object values with defaults. Use it to set defaults on options. Works with\nsupplying default values in sub-objects as well. Supports partial functionality (great with array\nfunctions). Mutates first argument and returns mutated argument.\n\n```js\nvar defaults = require('101/defaults');\nvar opts = { foo: 0, bar: 1 };\nvar defs = { foo: 1, bar: 2, qux: 2 };\n\ndefaults(opts, defs); // returns mutated `opts` { foo: 0, bar: 1, qux: 2 }\n[opts].map(defaults(defs)); // [ { foo: 0, bar: 1, qux: 2 } ]\n\nvar opts = {\n  foo: {\n    one: 1,\n    two: 2\n  }\n};\nvar defs = {\n  foo: {\n    two: 20,\n    three: 30\n  }\n};\ndefaults(opts, defs); // { foo: { one: 1, two: 2, three: 30 } }\n```\n\n## del\n\nFunctional version of delete obj[key] which returns the same obj without the deleted key.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar del = require('101/del');\nvar obj = {\n  foo: 1,\n  bar: 2\n};\n\ndel(obj, 'foo'); // { bar: 2 }\n\n// use it with array.map\n[obj, obj, obj].map(del('foo')); // [{ bar: 2 }, {same}, {same}]\n\n// supports keypaths by default\nvar obj = {\n  foo: {\n    moo: 1,\n    boo: 2\n  },\n  bar: 3\n};\n\ndel(obj, 'foo.moo'); // { foo: { boo: 2 }, bar:3 }\n\n// pass an array of keys to be deleted \ndel(obj, ['foo.moo', 'bar']) // { foo: { boo: 2 } }\n```\n\n## envIs\n\nFunctional version of `str === process.env.NODE_ENV`.\nOr's multiple environments.\n\n```js\nvar envIs = require('101/env-is');\n// process.env.NODE_ENV = development\nenvIs('development');     // true\nenvIs('production');      // false\nenvIs('staging', 'production');     // false\nenvIs('development', 'production'); // true\n```\n\n## equals\n\nFunctional implementation of Object.is with polyfill for browsers without implementations of Object.is\nSupports partial functionality (great with array functions).\n\n```js\nvar equals = require('101/equals');\n\nequals(1, 1);            // true\n[1,2,3].some(equals(1)); // true\nequals(1, '1');          // false\n```\n\n## exists\n\nSimple exists function.\n\n```js\nvar exists = require('101/exists');\n\nexists('foo');     // true\nexists(null);      // false\nexists(undefined); // false\n```\n\n## find\n\nJust like ES6's `array.find`.\n\nFinds the first value in the list that passes the given function (predicate) and returns it.\nIf list is not provided find will return a partial-function which accepts a list as the first argument.\n\n```js\nvar find = require('101/find');\nvar hasProps = require('101/has-properties');\nvar arr = [{ a: 1, b: 1 }, { b: 1 }, { c: 1 }];\n\nvar item = find(arr, hasProps({ a:1 }));\n// returns { a: 1, b: 1 }\n// returns null if not found\n\n// partial-function\nvar partial = find(hasProps({ a: 1 }));\nvar item = partial(arr);\n// returns { a: 1, b: 1 }\n// returns null if not found\n```\n\n## findIndex\n\nJust like ES6's `array.findIndex`.\n\nFinds the first value in the list that passes the given function (predicate) and returns it's index.\nIf list is not provided findIndex will return a partial-function which accepts a list as the first argument.\n\n```js\nvar findIndex = require('101/find-index');\nvar arr = [1, 2, 3];\n\nvar index = findIndex(arr, function (val, i, arr) {\n  return val === 2;\n});\n// returns 1\n// returns -1 if not found\n```\n\n## flip\n\nReturns a function with flipped arguments\n\n```js\nvar flip = require('101/flip');\nvar curry = require('101/curry');\nvar hasKeypaths = require('101/has-keypaths');\n\nvar hasFooBar = curry(flip(hasKeypaths))(['foo.bar']);\n\nhasFooBar({ foo: { bar : true } }); // true\n\n\nfunction prefix(pre, str) {\n  return pre + str;\n}\n\nflip(prefix)('hello', '_'); // \"_hello\"\n```\n\n## groupBy\nHashes an array into groups based on the value of a provided common key.\nWorks nicely with `pluck` and `reduce`.\n\n```js\nvar groupBy = require('101/group-by');\nvar arr = [\n    {id: 1, foo: 'bar'},\n    {id: 2, foo: 'qux'},\n    {id: 3, foo: 'qux'}\n];\n\ngroupBy(arr, 'foo')\n/*\n{\n  bar: [\n    {id: 1, foo: 'bar'}\n  ],\n  qux: [\n    {id: 2, foo: 'qux'},\n    {id: 3, foo: 'qux'}\n  ]\n}\n*/\n// always provide initial value when using with reduce!\narr.reduce(groupBy('foo'), {}) // assumes pluck if passed string\narr.reduce(groupBy(pluck('foo')), {}) // also accepts function\n/*\n{\n  bar: [\n    {id: 1, foo: 'bar'}\n  ],\n  qux: [\n    {id: 2, foo: 'qux'},\n    {id: 3, foo: 'qux'}\n  ]\n}\n*/\n```\n\n## hasKeypaths\n\nDetermines whether the keypaths exist and have the specified values.\nSupports partial functionality (great with array functions, and 101/find).\n\n```js\nvar hasKeypaths = require('101/has-keypaths');\nvar obj = {\n  foo: {\n    bar: {\n      qux: 1\n    }\n  }\n};\n\nhasKeypaths(obj, ['foo.bar.qux']);      // true\nhasKeypaths(obj, { 'foo.bar.qux': 1 }); // true\nhasKeypaths(obj, ['foo.qux']);          // false\nhasKeypaths(obj, { 'foo.bar': 2 });     // false\nhasKeypaths(obj, { 'foo.bar': 1, 'nope': 1 }); // false\n\n// optional 'deep' arg, defaults to true\nvar barObj = { bar: 1 };\nhasKeypaths(obj, { 'foo.bar': barObj });         // true\nhasKeypaths(obj, { 'foo.bar': barObj }, true);   // true\nhasKeypaths(obj, { 'foo.bar': barObj }, false);  // false\nhasKeypaths(obj, { 'foo.bar': obj.foo }, false); // true\nhasKeypaths(obj, ['foo.bar'], false);            // true, uses [hasOwnProperty vs in](http://stackoverflow.com/questions/13632999/if-key-in-object-or-ifobject-hasownpropertykey)\n\n// use it with find, findIndex, or filter!\nvar arr = [obj, { b: 1 }, { c: 1 }];\nfind(arr, hasKeypaths({ 'foo.bar.qux':1 })); // { foo: { bar: { qux: 1 } } }\nfind(arr, hasKeypaths(['foo.bar.qux']));     // { foo: { bar: { qux: 1 } } }\n\n// use it to verify options object has required properties\nvar opts = {\n  host: 'localhost',\n  port: '3333',\n  user: {\n    id: 5\n  }\n};\nhasKeypaths(opts, ['host', 'port', 'user.id']); // true\n\n```\n\n## hasProperties\n\nDetermines whether the keys exist and, if specified, has the values.\nSupports partial functionality (great with array functions, and 101/find).\nNOTE: I am considering deprecating this method, bc it is so similar to has-keypaths.\n\n```js\nvar hasProps = require('101/has-properties');\nvar obj = {\n  qux: 1\n};\nobj['foo.bar'] = 1\n\nhasProps(obj, ['foo', 'qux']); // true\nhasProps(obj, { qux: 1 }) // true\n\n// optional 'deep' arg, defaults to true\nvar barObj = { bar: 1 };\nhasProps(obj, { 'foo.bar': barObj });         // true\nhasProps(obj, { 'foo.bar': barObj }, true);   // true\nhasProps(obj, { 'foo.bar': barObj }, false);  // false\nhasProps(obj, ['foo.bar'], false);            // true, uses [hasOwnProperty vs in](http://stackoverflow.com/questions/13632999/if-key-in-object-or-ifobject-hasownpropertykey)\n// use it with find, findIndex, or filter!\nvar arr = [{ a: 1, b: 1 }, { b: 1 }, { c: 1 }];\nfind(arr, hasProps({ a:1 })); // { a: 1, b: 1 }\nfind(arr, hasProps(['a']));   // { a: 1, b: 1 }\n```\n\n## includes\n\nPolyfill of ES7 proposed Array.prototype.includes. Will default to Array.prototype.includes if\npresent.\n\n```js\nvar includes = require('101/includes');\nvar haystack = ['a', 'b', 'c', 'd', 'e'];\nincludes(haystack, 'c'); // true\n\n// optional 3rd argument, searchFrom. Begin searching the target array from a specified index.\nincludes(haystack, 'c', 3); // false\nincludes(haystack, 'c', 0); // true\n\n// partial argument functionality\nvar i = includes(haystack);\ni('c') // true\ni('g') // false\n\n// example composition usage:\nvar not = require('101/not');\nvar notIn = not(includes);\n[1, 2, 3, 4, 5].filter(notIn([1, 2, 3])); // [4, 5]\n```\n\n## indexBy\nHashes an array of objects based on the value of a provided common key.\nWorks nicely with `pluck` and `reduce`.\n\n```js\nvar arr = [\n  {foo: 'bar'},\n  {foo: 'qux'}\n];\n\narr.reduce(indexBy('foo'), {}) // assumes pluck if passed string\narr.reduce(indexBy(pluck('foo')), {}) // also accepts function\n// {bar: {foo: 'bar'}, qux: {foo: 'qux'}}\n// always provide initial value when using with reduce!\narr.reduce(indexBy(pluck('foo')), {}) // {bar: {foo: 'bar'}, qux: {foo: 'qux'}}\n```\n\n## instanceOf\n\nFunctional version of JavaScript's instanceof.\nSupports partial functionality (great with array functions).\n\n```js\nvar instanceOf = require('101/instance-of');\n\n['foo', 'bar', 1].map(instanceOf('string')); // [true, true, false]\n```\n\n## isBoolean\n\nFunctional version of `typeof val === 'boolean'`.\nSupports partial functionality (great with array functions).\n\n```js\nvar isBoolean = require('101/is-boolean');\n\n[true, false, 1].map(isBoolean); // [true, true, false]\n```\n\n## isEmpty\n\nFunctional version of val empty object, array or object\n\n```js\nvar isEmpty = require('101/is-empty');\n\nisEmpty([]); // true\nisEmpty({}); // true\nisEmpty(\"\"); // true\nisEmpty(\" \"); // false\n```\n\n## isFunction\n\nFunctional version of `typeof val === 'function'`\n\n```js\nvar isFunction = require('101/is-function');\n\n[parseInt, function () {}, 'foo'].map(isFunction); // [true, true, false]\n```\n\n## isInteger\n\nCheck if a value is an instance of an integer.\n\n```js\nvar isInteger = require('101/is-Integer');\n\nisInteger(101); // true\nisInteger(101.01); // false\n```\n\n## isNumber\n\nFunctional version of val typeof 'number'.\n\n```js\nvar isNumber = require('101/is-number');\n\n['foo', NaN, 1].map(isNumber); // [false, false, true]\n```\n\n## isObject\n\nFunctional *strict* version of val typeof 'object' (and not array or regexp)\n\n```js\nvar isObject = require('101/is-object');\n\n[{}, { foo: 1 }, 100].map(isObject); // [true, true, false]\n```\n\n## isRegExp\n\nCheck if a value is an instance of RegExp\n\n```js\nvar isRegExp = require('101/is-regexp');\n\n[new RegExp('.*'), /.*/, {}, 1].map(isRegExp); // [true, true, false, false]\n```\n\n## isString\n\nFunctional version of val typeof 'string'\n\n```js\nvar isString = require('101/is-string');\n\n['foo', 'bar', 1].map(isString); // [true, true, false]\n```\n\n## keysIn\n\nReturn an array containing all the keys of an object.\nIt differs from the native `Object.keys` by including also the `prototype` keys.\n\n```js\nvar keysIn = require('101/keys-in');\nvar User = function() {\n  this.msg = 'Hello World';\n}\nUser.prototype.isLoggedIn = function() { /* example function */ }\n\nvar user = new User();\nkeysIn(user); // ['msg', 'isLoggedIn']\n```\n\n## last\n\nReturns the last value of a list\n\n```js\nvar last = require('101/last');\n\nlast([1, 2, 3]); // 3\nlast('hello');   // 'o'\n```\n\n## lens\n\nCreate a lens to access a data structure. When passed a property key as a string, it returns a function `fn(obj)` that acts as a getter for that. It also exposes `.set(value, obj)` and `.mod(fn, obj)`.\n\n```js\nvar fooLens = lens('foo');\nvar toUpper = function(str) { return str.toUpperCase(); };\nvar obj = {\n  foo: 'foo',\n  bar: 'bar'\n};\n\nfooLens(obj); // =\u003e 'foo'\nfooLens.set('moo', obj); // =\u003e { foo: 'moo', bar: 'bar' }\nfooLens.mod(toUpper, obj); // =\u003e { foo: 'MOO', bar: 'bar' }\n```\n\nYou may also provide getter and setter functions.\n\n```js\nvar arr = ['foo', 'bar'];\nvar first = lens(\n    function(arr) { return arr[0]; },\n    function(val, arr) { var clone = arr.slice(); clone[0] = val; return clone; }\n);\n\nfirst(arr); // =\u003e 'foo'\nfirst.set('moo')(arr); // =\u003e ['moo', 'bar']\nfirst.mod(toUpper)(arr); // =\u003e ['FOO', 'bar']\n```\n\n## noop\n\nNo-op function\n\n```js\nrequire('101/noop'); // function () {}\n```\n\n## not\n\nFunctional version of `!`.\n\n```js\nvar not = require('101/not');\n\nnot(isString)('hey'); // false\nnot(isString)(100);   // true\n```\n\n## omit\n\nImmutable version of `delete obj.key`. Returns a new object without the specified keys.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar omit = require('101/omit');\nvar obj = {\n  foo: 1,\n  bar: 2\n};\n\nomit(obj, 'foo');          // { bar: 1 }\nomit(obj, ['foo']);        // { bar: 1 }\nomit(obj, ['foo', 'bar']); // { }\n\n// use it with array.map\n[obj, obj, obj].map(omit('foo')); // [{ bar: 1 }, { bar: 1 }, { bar: 1 }];\n```\n\n## or\n\nFunctional version of `||`.\nWorks great with `array.reduce`.\n\n```js\nvar or = require('101/or');\n\nor(true, true);   // true\nor(true, false);  // true\nor(false, false); // false\nor(\"foo\", false); // \"foo\"\n```\n\n## passAll\n\nMuxes arguments across many functions and `\u0026\u0026`'s the results.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar passAll = require('101/pass-all');\n\n['', 'foo', 'bar', 100].map(passAll(isString, isTruthy)); // [false, true, true, false]\n```\n\n## passAny\n\nMuxes arguments across many functions and `||`'s the results.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar passAny = require('101/pass-any');\n\n['', 'foo', 'bar', 100].map(passAny(isString, isNumber)); // [true, true, true, true]\n```\n\n## pick\n\nReturns a new object with the specified keys (with key values from obj).\nSupports regular expressions and partial functionality (great with array functions, like map).\n\n```js\nvar pick = require('101/pick');\nvar obj = {\n  foo: 1,\n  bar: 2,\n  qwk: {\n    wrk: 1\n  },\n  'qwk.wrk': 2\n};\n\npick(obj, 'foo');          // { foo: 1 }\npick(obj, RegExp('oo$'));  // { foo: 1 }\npick(obj, ['foo']);        // { foo: 1 }\npick(obj, ['foo', 'bar']); // { foo: 1, bar: 2 }\n\n// use it with array.map\n[obj, obj, obj].map(pick('foo')); // [{ foo: 1 }, { foo: 1 }, { foo: 1 }];\n\n// supports keypaths\npick(obj, 'qwk.wrk');      // { qwk: { wrk: 1 } }\npick(obj, '[\"qwk.wrk\"]');  // { 'qwk.wrk': 2 } }\n```\n\n## pluck\n\nFunctional version of obj[key], returns the value of the key from obj.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar pluck = require('101/pluck');\nvar obj = {\n  foo: 1,\n  bar: 2\n};\n\npluck(obj, 'foo'); // 1\n\n// use it with array.map\n[obj, obj, obj].map(pluck('foo')); // [1, 1, 1]\n\n// supports keypaths by default\nvar obj = {\n  foo: {\n    bar: 1\n  },\n  'foo.bar': 2\n};\n\npluck(obj, 'foo.bar'); // 1, supports keypaths by default\npluck(obj, 'foo.bar', false); // 2, pass false to not use keypaths\n```\n\n## put\n\nImmutable version of `obj[key] = val`. Returns a clone of the obj with the value put at the key.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar put = require('101/put');\nvar obj = {\n  foo: 1,\n  bar: 2\n};\n\nput(obj, 'baz', 3); // { foo: 1, bar:2, baz: 3 }\nobj; // { foo: 1, bar: 2 } (not modified)\n\n// use it with array.map\n[obj, obj, obj].map(put('foo', 100)); // [{ foo: 100, bar: 2 }, {copy}, {copy}]\nobj; // { foo: 1, bar: 2 } (not modified)\n\n// supports keypaths by default\nvar obj = {\n  bar: 2\n};\n\nput(obj, 'foo.qux', 100); // { foo: { qux: 100 }, bar: 2 }\nput(obj, {\n  'foo.qux': 100\n  'yolo': 1\n}); // { foo: { qux: 100 }, bar: 2, yolo: 1 }\nobj; // { foo: 1, bar: 2 } (not modified)\n```\n\n## set\n\nFunctional version of obj[key] = val, returns the same obj with the key and value set.\nSupports partial functionality (great with array functions, like map).\n\n```js\nvar set = require('101/set');\nvar obj = {\n  foo: 1,\n  bar: 2\n};\n\nset(obj, 'foo'); // 1\n\n// use it with array.map\n[obj, obj, obj].map(set('foo', 100)); // [{ foo: 100, bar: 2 }, {same}, {same}]\n\n// supports keypaths by default\nvar obj = {\n  bar: 2\n};\n\nset(obj, 'foo.qux', 100); // { foo: { qux: 100 }, bar: 2 }\nset(obj, {\n  'foo.qux': 100\n  'yolo': 1\n}); // { foo: { qux: 100 }, bar: 2, yolo: 1 }\n```\n\n## values\n\nReturns Array containing the values of the properties of an object\n\n```js\nvar values = require('101/values');\nvar obj {\n  foo: 'apple',\n  bar: 'orange'\n};\n\nvar objValues = values(obj);\nobjValues // ['apple', 'orange']\n```\n\n## xor\n\nExclusive or\nWorks great with `array.reduce`.\n\n```js\nvar xor = require('101/xor');\n\nxor(true, true);   // false\nxor(true, false);  // true\nxor(false, true);  // true\nxor(false, false); // false\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":["JavaScript","others","Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjmehta%2F101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftjmehta%2F101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjmehta%2F101/lists"}