Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DarrenPaulWright committed Nov 19, 2019
1 parent 7c5ece4 commit dea18ac
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 296 deletions.
7 changes: 1 addition & 6 deletions docs/clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@
| [settings.isCircular] | <code>Boolean</code> | <code>false</code> | If true then circular references will be handled |

**Example**
``` javascript
import { clone } from 'object-agent';

clone({ a: 'b', c: 'd' });
// => { a: 'b', c: 'd' }
```
``` javascriptimport { clone } from 'object-agent';clone({ a: 'b', c: 'd' });// => { a: 'b', c: 'd' }```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
17 changes: 1 addition & 16 deletions docs/deepEqual.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,7 @@
| item2 | <code>\*</code> |

**Example**
``` javascript
import { deepEqual } from 'object-agent';

deepEqual(null, undefined);
// => false

const item1 = {
a: ['b']
}
const item2 = {
a: ['c']
}

deepEqual(item1, item2);
// => false
```
``` javascriptimport { deepEqual } from 'object-agent';deepEqual(null, undefined);// => falseconst item1 = { a: ['b']}const item2 = { a: ['c']}deepEqual(item1, item2);// => false```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
19 changes: 1 addition & 18 deletions docs/diffUpdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,7 @@
| object2 | <code>Object</code> |

**Example**
``` javascript
import { diffUpdate } from 'object-agent';

const item1 = {
a: ['b'],
c: 'd',
e: null
}
const item2 = {
a: ['b'],
c: null,
e: null,
f: 'g'
}

diffUpdate(item1, item2);
// => { c: null, f: 'g' }
```
``` javascriptimport { diffUpdate } from 'object-agent';const item1 = { a: ['b'], c: 'd', e: null}const item2 = { a: ['b'], c: null, e: null, f: 'g'}diffUpdate(item1, item2);// => { c: null, f: 'g' }```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
16 changes: 1 addition & 15 deletions docs/forIn.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,7 @@
| callback | <code>function</code> | Provides two args: value and key |

**Example**
``` javascript
import { forIn } from 'object-agent';

const Thing = {
this.a = 'b';
};

Thing.prototype.c = 'd';

forIn(new Thing(), (value, key) => {
console.log(value, key);
});
// => 'b', 'a'
// => 'd', 'c'
```
``` javascriptimport { forIn } from 'object-agent';const Thing = { this.a = 'b';};Thing.prototype.c = 'd';forIn(new Thing(), (value, key) => { console.log(value, key);});// => 'b', 'a'// => 'd', 'c'```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
15 changes: 1 addition & 14 deletions docs/forOwn.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,7 @@
| callback | <code>function</code> | Provides two args: value and key |

**Example**
``` javascript
import { forOwn } from 'object-agent';

const thing = {
a: 'b',
c: 'd'
};

forOwn(thing, (value, key) => {
console.log(value, key);
});
// => 'b', 'a'
// => 'd', 'c'
```
``` javascriptimport { forOwn } from 'object-agent';const thing = { a: 'b', c: 'd'};forOwn(thing, (value, key) => { console.log(value, key);});// => 'b', 'a'// => 'd', 'c'```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
19 changes: 2 additions & 17 deletions docs/forOwnReduce.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,11 @@
| Param | Type | Description |
| --- | --- | --- |
| object | <code>Object</code> | |
| callback | <code>function</code> | Provides three args: result, value, and key |
| callback | <code>function</code> | Provides three args: result, value, and key. If the result is only mutated then you may not need to return it. |
| initialValue | <code>\*</code> | |

**Example**
``` javascript
import { forOwnReduce } from 'object-agent';

const thing = {
a: 'b',
c: 'd'
};

const output = forOwnReduce(thing, (result, value, key) => {
result.push([value, key]);
return result;
}, []);

console.log(output);
// => [['b', 'a'], ['d', 'c']]
```
``` javascriptimport { forOwnReduce } from 'object-agent';const thing = { a: 'b', c: 'd'};const output = forOwnReduce(thing, (result, value, key) => { result.push([value, key]); return result;}, []);console.log(output);// => [['b', 'a'], ['d', 'c']]```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
15 changes: 1 addition & 14 deletions docs/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,7 @@
| path | <code>String</code> | Dot delimited string |

**Example**
``` javascript
import { get } from 'object-agent';

const thing = {
a: [{
b: 'c'
}, {
b: 'd'
}]
};

get(thing, 'a.1.b');
// => 'd'
```
``` javascriptimport { get } from 'object-agent';const thing = { a: [{ b: 'c' }, { b: 'd' }]};get(thing, 'a.1.b');// => 'd'```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
15 changes: 1 addition & 14 deletions docs/has.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,7 @@
| path | <code>String</code> | Dot delimited string |

**Example**
``` javascript
import { has } from 'object-agent';

const thing = {
a: [{
b: 'c'
}, {
b: 'd'
}]
};

has(thing, 'a.1.b');
// => true
```
``` javascriptimport { has } from 'object-agent';const thing = { a: [{ b: 'c' }, { b: 'd' }]};has(thing, 'a.1.b');// => true```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
16 changes: 1 addition & 15 deletions docs/intersection.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,7 @@
| <code>\*</code>, <code>Array</code> |

**Example**
``` javascript
import { intersection } from 'object-agent';

intersection([1, 2, 3], [2, 3, 4], [5, 6, 2, 3]); // => [2, 3]

intersection({
a: 'b',
c: [1, 2, 3],
d: null
}, {
a: 'b',
c: [1, 3, 4]
})
// => { a: 'b', c: [1, 3] }
```
``` javascriptimport { intersection } from 'object-agent';intersection([1, 2, 3], [2, 3, 4], [5, 6, 2, 3]); // => [2, 3]intersection({ a: 'b', c: [1, 2, 3], d: null}, { a: 'b', c: [1, 3, 4]})// => { a: 'b', c: [1, 3] }```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
22 changes: 1 addition & 21 deletions docs/isEmpty.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,7 @@
| item | <code>\*</code> |

**Example**
``` javascript
import { isEmpty } from 'object-agent';

isEmpty(['a', 1, 'b']);
// => false

isEmpty([]);
// => true

isEmpty({ a: 'b' });
// => false

isEmpty({});
// => true

isEmpty(null);
// => true

isEmpty(undefined);
// => true
```
``` javascriptimport { isEmpty } from 'object-agent';isEmpty(['a', 1, 'b']);// => falseisEmpty([]);// => trueisEmpty({ a: 'b' });// => falseisEmpty({});// => trueisEmpty(null);// => trueisEmpty(undefined);// => true```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
13 changes: 1 addition & 12 deletions docs/isEqual.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@
| <code>\*</code>, <code>Array</code> | Can be an array of items or multiple args of items. |

**Example**
``` javascript
import { isEqual } from 'object-agent';

isEqual(null, undefined);
// => false

isEqual('a', 'a', 'a');
// => true

isEqual('a', 'a', 'a', null);
// => false
```
``` javascriptimport { isEqual } from 'object-agent';isEqual(null, undefined);// => falseisEqual('a', 'a', 'a');// => trueisEqual('a', 'a', 'a', null);// => false```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
12 changes: 1 addition & 11 deletions docs/mapOwn.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,7 @@
| [ignoreKeys] | <code>Array</code>, <code>String</code> | Any keys in this array will be ignored |

**Example**
``` javascript
import { mapOwn } from 'object-agent';

const thing = {
a: 'b',
c: 'd'
};

mapOwn(thing, (value, key) => value + ' ' + key);
// => { a: 'b a', c: 'd c' }
```
``` javascriptimport { mapOwn } from 'object-agent';const thing = { a: 'b', c: 'd'};mapOwn(thing, (value, key) => value + ' ' + key);// => { a: 'b a', c: 'd c' }```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
69 changes: 20 additions & 49 deletions docs/pathUtilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@
| [separator] | <code>String</code> | <code>.</code> | Defines the boundary between steps in the path. |

**Example**
``` javascript
import { appendToPath } from 'object-agent';

appendToPath('first.0', 'last');
// => 'first.0.last'
```
``` javascriptimport { appendToPath } from 'object-agent';appendToPath('first.0', 'last');// => 'first.0.last'```

<br><a name="countInString"></a>

### countInString(string, match) ⇒ <code>Number</code>
> Counts the number of instances of a string within another string

| Param | Type |
| --- | --- |
| string | <code>String</code> |
| match | <code>String</code> |

**Example**
``` javascriptimport { countInString } from 'object-agent';countInString('first.0', '.');// => 1```

<br><a name="firstInPath"></a>

Expand All @@ -43,12 +52,7 @@ appendToPath('first.0', 'last');
| [separator] | <code>String</code> | <code>.</code> | Defines the boundary between steps in the path. |

**Example**
``` javascript
import { firstInPath } from 'object-agent';

firstInPath('first.0.last');
// => 'first'
```
``` javascriptimport { firstInPath } from 'object-agent';firstInPath('first.0.last');// => 'first'```

<br><a name="initialInPath"></a>

Expand All @@ -62,12 +66,7 @@ firstInPath('first.0.last');
| [separator] | <code>String</code> | <code>.</code> | Defines the boundary between steps in the path. |

**Example**
``` javascript
import { initialInPath } from 'object-agent';

initialInPath('first.0.last');
// => 'first.0'
```
``` javascriptimport { initialInPath } from 'object-agent';initialInPath('first.0.last');// => 'first.0'```

<br><a name="lastInPath"></a>

Expand All @@ -81,12 +80,7 @@ initialInPath('first.0.last');
| [separator] | <code>String</code> | <code>.</code> | Defines the boundary between steps in the path. |

**Example**
``` javascript
import { lastInPath } from 'object-agent';

lastInPath('first.0.last');
// => 'last'
```
``` javascriptimport { lastInPath } from 'object-agent';lastInPath('first.0.last');// => 'last'```

<br><a name="tailInPath"></a>

Expand All @@ -100,12 +94,7 @@ lastInPath('first.0.last');
| [separator] | <code>String</code> | <code>.</code> | Defines the boundary between steps in the path. |

**Example**
``` javascript
import { tailInPath } from 'object-agent';

tailInPath('first.0.last');
// => '0.last'
```
``` javascriptimport { tailInPath } from 'object-agent';tailInPath('first.0.last');// => '0.last'```

<br><a name="walkPath"></a>

Expand All @@ -120,25 +109,7 @@ tailInPath('first.0.last');
| [separator] | <code>String</code> | <code>.</code> | Defines the boundary between steps in the path. |

**Example**
``` javascript
import { walkPath } from 'object-agent';

walkPath('first.0.last', (key, tail) => {
console.log(key, tail);
});
// => 'first', '0.last'
// => '0', 'last'
// => 'last', ''

walkPath('first.0.last', (key, tail) => {
console.log(key, tail);
if (key === '0') {
return true;
}
});
// => 'first', '0.last'
// => '0', 'last'
```
``` javascriptimport { walkPath } from 'object-agent';walkPath('first.0.last', (key, tail) => { console.log(key, tail);});// => 'first', '0.last'// => '0', 'last'// => 'last', ''walkPath('first.0.last', (key, tail) => { console.log(key, tail); if (key === '0') { return true; }});// => 'first', '0.last'// => '0', 'last'```

[npm]: https://img.shields.io/npm/v/object-agent.svg
[npm-url]: https://npmjs.com/package/object-agent
Expand Down
Loading

0 comments on commit dea18ac

Please sign in to comment.