## Object
RubyNice version to add methods directly to the class by monkey patching
* [Object](#Object)
* [.eachWithIndex(loop_function)](#Object+eachWithIndex) → Object.<any>
* [.mapObject(loop_function)](#Object+mapObject) → Object.<any>
* [.filterObject(loop_function)](#Object+filterObject) → Object.<any>
* [.getFirst()](#Object+getFirst) → [Object](#Object)
* [.getLast()](#Object+getLast) → [Object](#Object)
* [.getSample()](#Object+getSample) → [Object](#Object)
### object.eachWithIndex(loop_function) → Object.<any>
Iterates over all elements of the object
Breaks if returning false
**Returns**: Object.<any> - returns itself
| Param | Type |
| --- | --- |
| loop_function | [eachObjectLoopCallback](#eachObjectLoopCallback) \| eachArrayLoopCallback |
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.eachWithIndex((key, value, index) => {
if(condition) return false;
console.log(key, value);
})
```
### object.mapObject(loop_function) → Object.<any>
Maps over all first level elements of an object
**Returns**: Object.<any> - returns itself
| Param | Type |
| --- | --- |
| loop_function | [eachObjectLoopCallback](#eachObjectLoopCallback) |
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.mapObject((key, value, index) => {
return value;
})
// => ['one','two','three']
```
### object.filterObject(loop_function) → Object.<any>
Filter over all first level elements of an object
The object gets deep cloned, to ensure references of sub objects are not preserved.
**Returns**: Object.<any> - returns itself
| Param | Type |
| --- | --- |
| loop_function | [eachObjectLoopCallback](#eachObjectLoopCallback) |
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.filterObject((key, value, index) => {
return value.length === 3;
})
// => {a: 'one', b: 'two'}
```
### object.getFirst() → [Object](#Object)
Returns the first element of the object
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.getFirst()
// => { a: 'one' }
```
### object.getLast() → [Object](#Object)
Returns the last element of the object
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.getLast()
// => { c: 'three' }
```
### object.getSample() → [Object](#Object)
Returns a random element of the object
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.getSample() // => { b: 'two' }
```
## value(loop_function) → Object.<any>
Iterates over all elements of the object
Breaks if returning false
**Returns**: Object.<any> - returns itself
| Param | Type |
| --- | --- |
| loop_function | [eachObjectLoopCallback](#eachObjectLoopCallback) \| eachArrayLoopCallback |
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.eachWithIndex((key, value, index) => {
if(condition) return false;
console.log(key, value);
})
```
## value(loop_function) → Object.<any>
Maps over all first level elements of an object.
The object gets deep cloned, to ensure references of sub objects are not preserved.
**Returns**: Object.<any> - returns itself
| Param | Type |
| --- | --- |
| loop_function | [eachObjectLoopCallback](#eachObjectLoopCallback) |
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.mapObject((key, value, index) => {
return value;
})
// => ['one','two','three']
```
## value(loop_function) → Object.<any>
Filter over all first level elements of an object
The object gets deep cloned, to ensure references of sub objects are not preserved.
**Returns**: Object.<any> - returns itself
| Param | Type |
| --- | --- |
| loop_function | [eachObjectLoopCallback](#eachObjectLoopCallback) |
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.filterObject((key, value, index) => {
return value.length === 3;
})
// => {a: 'one', b: 'two'}
```
## value() → [Object](#Object)
Returns the first element of the object
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.getFirst()
// => { a: 'one' }
```
## value() → [Object](#Object)
Returns the last element of the object
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.getLast()
// => { c: 'three' }
```
## value() → [Object](#Object)
Returns a random element of the object
**Example**
```js
{ a: 'one', b: 'two', c: 'three'}.getSample() // => { b: 'two' }
```
## eachObjectLoopCallback : function
**Kind**: global typedef
| Param | Type |
| --- | --- |
| key | any |
| value | any |
| index | number |