{"id":13487,"library":"lodash.where","title":"lodash.where module","description":"The `lodash.where` package provides a standalone module for the `_.where` function, as it existed in Lodash v3.x. This function facilitated filtering collections (arrays of objects) based on an object of properties, returning all matching elements. The package itself is at version 3.1.0 and was last published over 11 years ago, corresponding to the Lodash v3 major release cycle. The `_.where` function was officially deprecated and removed in Lodash v4.0.0, which shifted towards more functional programming paradigms and standardized methods like `_.filter` combined with `_.matches` for equivalent functionality. This package is no longer maintained, does not receive updates (including security patches), and is incompatible with modern JavaScript module systems like ESM without a CommonJS interop layer. The primary Lodash library is currently in its 4.x series (e.g., 4.18.1) and follows a stable but slower release cadence since around 2020.","status":"abandoned","version":"3.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/lodash/lodash","tags":["javascript","lodash","lodash-modularized","stdlib","util"],"install":[{"cmd":"npm install lodash.where","lang":"bash","label":"npm"},{"cmd":"yarn add lodash.where","lang":"bash","label":"yarn"},{"cmd":"pnpm add lodash.where","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module from the Lodash v3 era and does not support ES module imports. Using `import` syntax will result in a runtime error.","wrong":"import { where } from 'lodash.where';","symbol":"where","correct":"const where = require('lodash.where');"}],"quickstart":{"code":"const where = require('lodash.where');\n\nconst users = [\n  { 'user': 'barney', 'age': 36, 'active': true },\n  { 'user': 'fred',   'age': 40, 'active': false },\n  { 'user': 'pebbles', 'age': 1, 'active': true }\n];\n\nconst activeUsers = where(users, { 'active': true });\nconsole.log('Active Users:', activeUsers);\n// Expected: [ { user: 'barney', age: 36, active: true }, { user: 'pebbles', age: 1, active: true } ]\n\nconst oldInactiveUser = where(users, { 'age': 40, 'active': false });\nconsole.log('Old Inactive User:', oldInactiveUser);\n// Expected: [ { user: 'fred', age: 40, active: false } ]\n\nconst noMatch = where(users, { 'name': 'invalid' });\nconsole.log('No Match:', noMatch);\n// Expected: []","lang":"javascript","description":"Demonstrates how to import and use the `_.where` function to filter an array of objects based on a property matcher."},"warnings":[{"fix":"Replace `_.where(collection, properties)` with `_.filter(collection, _.matches(properties))` or `collection.filter(item => _.isMatch(item, properties))` using a modern Lodash version or native JavaScript.","message":"The `_.where` function was removed in Lodash v4.0.0. This package provides the v3 implementation, which is not compatible with or present in modern Lodash versions. Direct usage of `_.where` with Lodash v4+ will result in a TypeError.","severity":"breaking","affected_versions":">=4.0.0 (of main lodash library)"},{"fix":"Migrate to modern Lodash (`lodash` package v4.x) and use `_.filter` with `_.matches` or native JavaScript array methods and `Object.entries` for filtering. Consider newer utility libraries like Radash for modern JavaScript projects.","message":"This `lodash.where` package (v3.1.0) is not actively maintained and has not received updates or security patches for over a decade. Using unmaintained software can expose applications to known or undiscovered vulnerabilities.","severity":"breaking","affected_versions":">=3.1.0"},{"fix":"Ensure your environment supports CommonJS `require()` statements or transpile your code if targeting a pure ESM environment. For new projects, prefer libraries designed for ESM.","message":"This package is a CommonJS module (`require()`) and does not natively support ES Modules (`import`). Attempting to use `import` syntax will lead to errors in pure ESM environments without a transpilation or CJS interop layer.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Before introducing Lodash (or older Lodash modules), evaluate if the required functionality can be achieved using native JavaScript array methods (e.g., `filter`, `find`), object methods (`Object.keys`, `Object.values`, `Object.entries`), or newer language features like optional chaining and null coalescing.","message":"Lodash, including older modular packages like `lodash.where`, is often misunderstood regarding its necessity in modern JavaScript. Many common utilities provided by Lodash are now available natively in ES6+ JavaScript, reducing the need for the library or specific modules.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'11':50 '2020':141 '3.1.0':44 '4':126 '4.18.1':130 'ago':52 'around':140 'array':25 'base':28 'cadenc':138 'collect':24 'combin':84 'commonj':115 'correspond':53 'current':123 'cycl':60 'deprec':66 'e.g':129 'element':37 'equival':88 'esm':112 'exist':16 'facilit':22 'filter':23,83 'follow':132 'function':13,21,63,76,89 'includ':100 'incompat':105 'interop':116 'javascript':108,142 'last':47 'layer':117 'librari':121 'like':82,111 'lodash':18,56,70,120,143,145 'lodash-modular':144 'lodash.where':1,4 'longer':94 'maintain':95 'major':58 'match':36,86 'method':81 'modern':107 'modul':2,9,109 'modular':146 'object':27,31 'offici':65 'packag':5,39,91 'paradigm':78 'patch':102 'primari':119 'program':77 'properti':33 'provid':6 'publish':48 'receiv':98 'releas':59,137 'remov':68 'return':34 'secur':101 'seri':128 'shift':73 'sinc':139 'slower':136 'stabl':134 'standalon':8 'standard':80 'stdlib':147 'system':110 'toward':74 'updat':99 'util':148 'v3':57 'v3.x':19 'v4.0.0':71 'version':43 'without':113 'x':127 'year':51","created_at":"2026-04-20T01:54:45.821498+00:00","updated_at":"2026-04-20T01:54:45.821498+00:00","problems":[{"fix":"If you are using `lodash` v4+, replace `_.where(collection, properties)` with `_.filter(collection, _.matches(properties))` or `collection.filter(item => item.property === value)` for simple cases. If you specifically need the old `lodash.where` behavior, you must use Lodash v3.x or this `lodash.where` package (though not recommended due to lack of maintenance).","cause":"You are trying to use the `_.where` function with a version of the main `lodash` library (typically v4.0.0 or later) that has removed this function.","error":"TypeError: _.where is not a function"},{"fix":"Change your import to a CommonJS `require()` statement: `const where = require('lodash.where');`. Ensure your project's module system configuration (e.g., `package.json` `\"type\": \"module\"`) correctly handles CJS interoperability.","cause":"You are attempting to use an ES module `import` statement for `lodash.where` in a CommonJS environment, or in an ESM environment without proper interop. This package is a CommonJS module.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"If in a browser, use a compatible bundler. If in a Node.js ESM module, you might need to convert the file to CommonJS or use `createRequire` from the `module` built-in module, though it's strongly advised to migrate away from this abandoned package.","cause":"You are attempting to use `require()` in an ES Module context where `require` is not globally available, or in a browser environment without a bundler like Webpack or Browserify.","error":"ReferenceError: require is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://lodash.com/","github":"https://github.com/lodash/lodash","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/lodash.where","openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}