dmbobjects

Javascript objects manipulation emulating arrays methods like map and filter. Also pick, fusion and validation of objects with schemas.

Usage no npm install needed!

<script type="module">
  import dmbobjects from 'https://cdn.skypack.dev/dmbobjects';
</script>

README

dmbobjects

Javascript objects manipulation emulating arrays methods like map and filter. Also pick, fusion and validation of objects with schemas.

Install

npm i dmbobjects -s

Import

const o = require('dmbobjects');

Functions overview

copy

Returns a independent copy of one object.

pick

Obtain a new object with only the properties you want.

filter

Obtain a new object with only the properties you select by a callback.

map

Obtain a new object with the values modified by your own callback.

update

Update an object with the data of another object using different modifiers or even your own callback.

fusion

Obtain a new object with the data of another object using different modifiers or even your own callback applied over all the resulting object properties.

validate

Validate if an object matches a validation scheme defined by you.

validateReturn

Same as validate, but it don't modify the original object and it returns a corrected object if validation is fine.

properties

Returns an array with the properties of the given object.

get

Returns the value of any property at the object. Especially useful when working with nested properties.

put

Add or modify the value of any property at the object. Especially useful when working with nested properties.

have

Returns true if exists the indicated property at the object. Especially useful when working with nested properties.