{
  "_id": "lodash-id",
  "maintainers": [
    {
      "name": "typicode",
      "email": "typicode@gmail.com"
    }
  ],
  "keywords": [
    "lodash",
    "lowdb",
    "underscore",
    "id",
    "resource",
    "mixin"
  ],
  "dist-tags": {
    "latest": "0.14.1"
  },
  "author": {
    "name": "Typicode",
    "email": "typicode@gmail.com"
  },
  "_rev": "5-5b0074a1df26b72cf869cdb89f72de71",
  "description": "Use JavaScript objects as databases",
  "readme": "# lodash-id [![Build Status](https://travis-ci.org/typicode/lodash-id.svg)](https://travis-ci.org/typicode/lodash-id) [![NPM version](https://badge.fury.io/js/lodash-id.svg)](http://badge.fury.io/js/lodash-id)\n\n> `lodash-id` makes it easy to manipulate id-based resources with [lodash](https://lodash.com/) or [lowdb](https://github.com/typicode/lowdb)\n\n* `getById`\n* `insert`\n* `upsert`\n* `updateById`\n* `updateWhere`\n* `replaceById`\n* `removeById`\n* `removeWhere`\n* `createId`\n\n## Install\n\n```bash\n# with lodash\nnpm install lodash lodash-id --save\n\n# with lowdb\nnpm install lowdb lodash-id --save\n```\n\n__Note__ `lodash-id` is also compatible with [underscore](http://underscorejs.org/)\n\n## API\n\nIn the API examples, we're assuming `db` to be:\n\n```js\nconst db = {\n  posts: [\n    {id: 1, body: 'one', published: false},\n    {id: 2, body: 'two', published: true}\n  ],\n  comments: [\n    {id: 1, body: 'foo', postId: 1},\n    {id: 2, body: 'bar', postId: 2}\n  ]\n}\n```\n\n__getById(collection, id)__\n\nFinds and returns document by id or undefined.\n\n```js\nconst post = _.getById(db.posts, 1)\n```\n\n__insert(collection, document)__\n\nAdds document to collection, sets an id and returns created document.\n\n```js\nconst post = _.insert(db.posts, { body: 'New post' })\n```\n\nIf the document already has an id, and it is the same as an existing document in the collection, an error is thrown.\n\n```js\n_.insert(db.posts, { id: 1, body: 'New post' })\n_.insert(db.posts, { id: 1, title: 'New title' }) // Throws an error\n```\n\n__upsert(collection, document)__\n\nAdds document to collection, sets an id and returns created document.\n\n```js\nconst post = _.upsert(db.posts, { body: 'New post' })\n```\n\nIf the document already has an id, it will be used to insert or replace.\n\n```js\n_.upsert(db.posts, { id: 1, body: 'New post' })\n_.upsert(db.posts, { id: 1, title: 'New title' })\n_.getById(db.posts, 1) // { id: 1, title: 'New title' }\n```\n\n__updateById(collection, id, attrs)__\n\nFinds document by id, copies properties to it and returns updated document or undefined.\n\n```js\nconst post = _.updateById(db.posts, 1, { body: 'Updated body' })\n```\n\n__updateWhere(collection, whereAttrs, attrs)__\n\nFinds documents using `_.where`, updates documents and returns updated documents or an empty array.\n\n```js\n// Publish all unpublished posts\nconst posts = _.updateWhere(db.posts, { published: false }, { published: true })\n```\n\n__replaceById(collection, id, attrs)__\n\nFinds document by id, replaces properties and returns document or undefined.\n\n```js\nconst post = _.replaceById(db.posts, 1, { foo: 'bar' })\n```\n\n__removeById(collection, id)__\n\nRemoves document from collection and returns it or undefined.\n\n```js\nconst comment = _.removeById(db.comments, 1)\n```\n\n__removeWhere(collection, whereAttrs)__\n\nRemoves documents from collection using `_.where` and returns removed documents or an empty array.\n\n```js\nconst comments = _.removeWhere(db.comments, { postId: 1 })\n```\n\n__id__\n\nOverwrite it if you want to use another id property.\n\n```js\n_.id = '_id'\n```\n\n__createId(collectionName, doc)__\n\nCalled by lodash-id when a document is inserted. Overwrite it if you want to change id generation algorithm.\n\n```js\n_.createId = (collectionName, item) => `${collectionName}-${item.prop}-${Date.now()}`\n```\n\n## Changelog\n\nSee details changes for each version in the [release notes](https://github.com/typicode/lodash-id/releases).\n\n## License\n\nMIT - [Typicode :cactus:](https://github.com/typicode)\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/typicode/lodash-id.git"
  },
  "bugs": {
    "url": "https://github.com/typicode/lodash-id/issues"
  },
  "license": "MIT",
  "versions": {
    "0.13.0": {
      "name": "lodash-id",
      "version": "0.13.0",
      "description": "Use JavaScript objects as databases",
      "main": "src/node.js",
      "scripts": {
        "test": "grunt test",
        "build": "grunt",
        "prepush": "npm test",
        "prepublish": "npm run build && pkg-ok"
      },
      "author": {
        "name": "Typicode",
        "email": "typicode@gmail.com"
      },
      "license": "MIT",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/typicode/lodash-id.git"
      },
      "keywords": [
        "underscore",
        "lodash",
        "mixin",
        "database"
      ],
      "devDependencies": {
        "grunt": "~0.4.2",
        "grunt-browserify": "^3.8.0",
        "grunt-cli": "~0.1.11",
        "grunt-contrib-jshint": "~0.7.2",
        "grunt-contrib-uglify": "^0.9.1",
        "grunt-contrib-watch": "~0.5.3",
        "grunt-mocha-test": "~0.7.0",
        "husky": "^0.11.8",
        "lodash": "^4.6.1",
        "pkg-ok": "^1.0.1",
        "sinon": "~1.8.1",
        "underscore": "^1.8.3"
      },
      "gitHead": "1929f719928a1b772111ee92c124edc7c6a88d9b",
      "bugs": {
        "url": "https://github.com/typicode/lodash-id/issues"
      },
      "homepage": "https://github.com/typicode/lodash-id#readme",
      "_id": "lodash-id@0.13.0",
      "_shasum": "1b2086c24f004f07411bdb09b775072114bcddc6",
      "_from": ".",
      "_npmVersion": "2.15.11",
      "_nodeVersion": "4.7.3",
      "_npmUser": {
        "name": "typicode",
        "email": "typicode@gmail.com"
      },
      "dist": {
        "shasum": "1b2086c24f004f07411bdb09b775072114bcddc6",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/lodash-id/-/lodash-id-0.13.0.tgz",
        "integrity": "sha512-HbPIMhbU2w1qQZSfyiN3VAORDpMiJi90QMuU4e8HMfmM8d0kM6+mdAaWVBPx8tlraQo8bLxkWDZ9oFye7/GLdA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIEwurRGp/jLu3p69/5B40esjmlGkmU/Z4Y8p4od/tcgVAiEAngIDrGf6Zro70nzR3IFJ1TxSYMDHaFQ2t/kkf1AxUvw="
          }
        ]
      },
      "maintainers": [
        {
          "name": "typicode",
          "email": "typicode@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "packages-12-west.internal.npmjs.com",
        "tmp": "tmp/lodash-id-0.13.0.tgz_1487630343101_0.5395266907289624"
      },
      "directories": {}
    },
    "0.14.0": {
      "name": "lodash-id",
      "version": "0.14.0",
      "description": "Use JavaScript objects as databases",
      "main": "src/index.js",
      "scripts": {
        "test": "mocha && standard && pkg-ok",
        "prepush": "npm test",
        "prepublish": "npm test"
      },
      "author": {
        "name": "Typicode",
        "email": "typicode@gmail.com"
      },
      "license": "MIT",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/typicode/lodash-id.git"
      },
      "keywords": [
        "lodash",
        "lowdb",
        "underscore",
        "id",
        "resource",
        "mixin"
      ],
      "devDependencies": {
        "husky": "^0.11.8",
        "lodash": "^4.6.1",
        "mocha": "^3.2.0",
        "pkg-ok": "^1.0.1",
        "sinon": "~1.8.1",
        "standard": "^8.6.0",
        "underscore": "^1.8.3",
        "webpack": "^2.2.1"
      },
      "engines": {
        "node": ">= 4"
      },
      "standard": {
        "fix": true,
        "env": {
          "mocha": true
        }
      },
      "gitHead": "adf8c8e99e598c448e6db6ec5705de9d9edb96ed",
      "bugs": {
        "url": "https://github.com/typicode/lodash-id/issues"
      },
      "homepage": "https://github.com/typicode/lodash-id#readme",
      "_id": "lodash-id@0.14.0",
      "_shasum": "baf48934e543a1b5d6346f8c84698b1a8c803896",
      "_from": ".",
      "_npmVersion": "4.1.2",
      "_nodeVersion": "7.7.2",
      "_npmUser": {
        "name": "typicode",
        "email": "typicode@gmail.com"
      },
      "dist": {
        "shasum": "baf48934e543a1b5d6346f8c84698b1a8c803896",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/lodash-id/-/lodash-id-0.14.0.tgz",
        "integrity": "sha512-wNpqOR4jiCDsWeaE3AAyu8Ivn8M1uMrV8WH6hFp1wEqt/7Zl4J9U5At24xV+ct0U7KDJypaoNIGn3QSGh+wd0w==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQDsC/8MOBzFBqgiEomrHOcHAx/TRQ1lSyZsFSdk9hqqLgIgbmFaV0YqIZRvY468KibahYwum0weVt/YeUhRjVvOdR0="
          }
        ]
      },
      "maintainers": [
        {
          "name": "typicode",
          "email": "typicode@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "packages-18-east.internal.npmjs.com",
        "tmp": "tmp/lodash-id-0.14.0.tgz_1489530322395_0.7156153141986579"
      },
      "directories": {}
    },
    "0.14.1": {
      "name": "lodash-id",
      "version": "0.14.1",
      "description": "Use JavaScript objects as databases",
      "main": "src/index.js",
      "scripts": {
        "test": "mocha && standard && pkg-ok",
        "prepush": "npm test",
        "prepublish": "npm test"
      },
      "author": {
        "name": "Typicode",
        "email": "typicode@gmail.com"
      },
      "license": "MIT",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/typicode/lodash-id.git"
      },
      "keywords": [
        "lodash",
        "lowdb",
        "underscore",
        "id",
        "resource",
        "mixin"
      ],
      "devDependencies": {
        "husky": "^0.11.8",
        "lodash": "^4.6.1",
        "mocha": "^3.2.0",
        "pkg-ok": "^1.0.1",
        "sinon": "~1.8.1",
        "standard": "^8.6.0",
        "underscore": "^1.8.3",
        "webpack": "^2.2.1"
      },
      "engines": {
        "node": ">= 4"
      },
      "standard": {
        "fix": true,
        "env": {
          "mocha": true
        }
      },
      "gitHead": "9d3fc01c17855cf51bf4d6f255787f92412ee815",
      "bugs": {
        "url": "https://github.com/typicode/lodash-id/issues"
      },
      "homepage": "https://github.com/typicode/lodash-id#readme",
      "_id": "lodash-id@0.14.1",
      "_nodeVersion": "16.2.0",
      "_npmVersion": "7.15.0",
      "dist": {
        "integrity": "sha512-ikQPBTiq/d5m6dfKQlFdIXFzvThPi2Be9/AHxktOnDSfSxE1j9ICbBT5Elk1ke7HSTgM38LHTpmJovo9/klnLg==",
        "shasum": "dffa1f1f8b90d1803bb0d70b7d7547e10751e80b",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/lodash-id/-/lodash-id-0.14.1.tgz",
        "fileCount": 6,
        "unpackedSize": 15385,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwCwpCRA9TVsSAnZWagAAamQP/AwgfZl0AflHe6mrAWEK\nZuIuwJDP+Kh0k2zKIv7/DdzgqrnqxFZ2yBDQlw4Hof4qJWng3955/j3XZlFV\njXJ9jpGj7p6B1fWjxoFKHdK9Vd4hKpcjBG/SjWEZgQG8WMBPX+e/Hb6YHQd6\nUAv5xwE31qjGtXQyrXfIHY3umohA/RxIvcrXYb3sD4+Xn0YjnCETzWTOh/pQ\nKBdyVobNhSRjD3oxO3UiBq+uYHP/3mhsAH+xAgznOkG+ttU32AM3PtWYYMp2\nIWEDDs02TF65EurUVgb3T1GapUeHic/AN7aBl2RrnxG9q/r7JuyO0hvFUsQ6\nXDC1q3pDgZVjGvRoWcrNvOBQkYmJnbG1ZsWabZvZE/S38iPhfs/qFQsgQ1gD\nh50d7mbKiywnyNpcCyd7SiCfE8qXi8IM3ryoUapCwVYZqUeYGpg5+QdQNa1E\nMvUkUkDunbCJrBabkHUYe+wA0sHYjJ75LN6BZkdShJtkWsEPDunLvvM7XjiZ\nw9T8UECapFGgLXpHoGdgTyS8qDclIvC8l8Rvt9heblaZxkwo8yvcPZcIZmdP\n/+d7E1hHmKjKAZawr2chswWFv7jYIMSEVUe6rHEyq2r4t4jioGl+ziBjE35f\n/utq6G5u0e1iLShM5/vYdqGiMHpApu/W4Z4Z55y9TQUAGuqfXq6SG0YNxDs/\nRJzs\r\n=XXyB\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQCgDepSj4HMy5u5iBmg5UCSvfOXpwtqqLQh8FOyOTzbuQIgEGG/Rqu8krsxcbd4XfXH32ieOE5S2bb6EnpHWVmMoUM="
          }
        ]
      },
      "_npmUser": {
        "name": "typicode",
        "email": "typicode@gmail.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "typicode",
          "email": "typicode@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/lodash-id_0.14.1_1623206953412_0.8508626021740429"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "lodash-id",
  "time": {
    "modified": "2026-06-16T13:20:00.960Z",
    "created": "2017-02-20T22:39:04.967Z",
    "0.13.0": "2017-02-20T22:39:04.967Z",
    "0.14.0": "2017-03-14T22:25:22.980Z",
    "0.14.1": "2021-06-09T02:49:13.537Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/typicode/lodash-id#readme"
}