Skip to content

filterObj

Filter the properties of the object, remove the properties of the object in the list array, return a new object, usually used to remove null characters and null

API

Return

argumentInstructionstype
ObjectReturn an objectObject

Options

argumentInstructionstypeDefault value
objObjects to be filteredobject
listFamiliar array to filterarray

Example

js
import { filterObj } from 'ranuts';

const obj = {
  name: 'chaxus',
  age: 10,
  address: 'spark',
};

const result = filterObj(obj, ['name', 'address']);

console.log(result);

// { age:10 }

Released under the MIT License.