0.0.2 • Published 4 years ago

lodash-f v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

lodash-f

基于 lodash 实现上层的工具方法集

Getting Started

Install dependencies,

$ npm i

Start the dev server,

$ npm start

Build documentation,

$ npm run docs:build

Build library via father-build,

$ npm run build

findItem

findItem(array, validateKey, validateValue, targetKey=undefined)

“Array” 方法,根据指定的 key 和 value 循环数组得到目标数据后按规则取出,规则可不填

参数

  • array (Array): 数据源。
  • validateKey (string): 需要循环验证的 key。
  • validateValue (var): 需要循环验证的 value。
  • targetKey: 按规则取出。
import { findItem } from 'lodash-f';

const arr = [
  { a: 1, b: 11 },
  { a: 2, b: 22 },
];

findItem(arr, 'a', 2, 'b')

// => 22