Skip to content

Commit

Permalink
Merge branch 'hotfix/4.34.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrmnn committed Jul 6, 2022
2 parents ae0abe0 + e9f6899 commit 84ad447
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ The flatMap method iterates through the collection and passes each value to the
const collection = collect([
{
name: 'Darwin Núñez',
number: 10,
number: 27,
},
{
name: 'Mohamed Salah',
Expand Down Expand Up @@ -924,7 +924,7 @@ The flip method swaps the collection's keys with their corresponding values:
```js
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
});

const flipped = collection.flip();
Expand All @@ -933,7 +933,7 @@ flipped.all();

// {
// 'Darwin Núñez': 'name',
// '10': 'number',
// '27': 'number',
// }
```

Expand All @@ -959,7 +959,7 @@ The forget method removes an item from the collection by its key:
```js
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
});

collection.forget('number');
Expand Down
2 changes: 1 addition & 1 deletion docs/api/flatMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The flatMap method iterates through the collection and passes each value to the
const collection = collect([
{
name: 'Darwin Núñez',
number: 10,
number: 27,
},
{
name: 'Mohamed Salah',
Expand Down
4 changes: 2 additions & 2 deletions docs/api/flip.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The flip method swaps the collection's keys with their corresponding values:
```js
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
});

const flipped = collection.flip();
Expand All @@ -14,7 +14,7 @@ flipped.all();

// {
// 'Darwin Núñez': 'name',
// '10': 'number',
// '27': 'number',
// }
```

Expand Down
2 changes: 1 addition & 1 deletion docs/api/forget.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The forget method removes an item from the collection by its key:
```js
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
});

collection.forget('number');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "collect.js",
"version": "4.34.2",
"version": "4.34.3",
"description": "Convenient and dependency free wrapper for working with arrays and objects.",
"main": "dist/index.js",
"typings": "index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions test/methods/count_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = (it, expect, collect) => {

it('should return the number of items on an object', () => {
expect(collect({ name: 'Darwin Núñez' }).count()).to.eql(1);
expect(collect({ name: 'Darwin Núñez', number: 19 }).count()).to.eql(2);
expect(collect({ name: 'Darwin Núñez', number: 19, club: 'Liverpool FC' }).count()).to.eql(3);
expect(collect({ name: 'Darwin Núñez', number: 27 }).count()).to.eql(2);
expect(collect({ name: 'Darwin Núñez', number: 27, club: 'Liverpool FC' }).count()).to.eql(3);
});

it('should return the number of items on an array of objects', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/methods/dump_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ module.exports = (it, expect, collect) => {
const mockConsole = hoax(console, 'log');

collect([1, 2, 3]).dump();
collect({ name: 'Darwin Núñez', number: 19 }).dump();
collect({ name: 'Darwin Núñez', number: 27 }).dump();

mockConsole.reset();

expect(mockConsole.calls).to.eql([
[collect([1, 2, 3])],
[collect({ name: 'Darwin Núñez', number: 19 })],
[collect({ name: 'Darwin Núñez', number: 27 })],
]);
});
};
4 changes: 2 additions & 2 deletions test/methods/intersectByKeys_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = (it, expect, collect) => {
+ 'are not present in the given array or collection', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 19,
number: 27,
});

const collection2 = collect({
Expand All @@ -22,7 +22,7 @@ module.exports = (it, expect, collect) => {

expect(collection.intersectByKeys(collection2).all()).to.eql({
name: 'Darwin Núñez',
number: 19,
number: 27,
});
});
};
2 changes: 1 addition & 1 deletion test/methods/keys_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = (it, expect, collect) => {
it('should return the collection keys', () => {
const player = {
name: 'Darwin Núñez',
number: 19,
number: 27,
club: 'Liverpool FC',
};

Expand Down
4 changes: 2 additions & 2 deletions test/methods/partition_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (it, expect, collect) => {
it('should also work when collection is based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 19,
number: 27,
club: 'Liverpool FC',
});

Expand All @@ -29,7 +29,7 @@ module.exports = (it, expect, collect) => {
club: 'Liverpool FC',
}),
collect({
number: 19,
number: 27,
}),
]);
});
Expand Down
12 changes: 6 additions & 6 deletions test/methods/search_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = (it, expect, collect) => {
it('should return false if no items were found in objec', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 19,
number: 27,
club: 'Liverpool FC',
});

Expand All @@ -49,18 +49,18 @@ module.exports = (it, expect, collect) => {
it('should work when collection is based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 19,
number: 27,
club: 'Liverpool FC',
});

expect(collection.search('Darwin Núñez')).to.eql('name');
expect(collection.search('Darwin Nunez')).to.eql(false);

expect(collection.search(19)).to.eql('number');
expect(collection.search('19')).to.eql('number');
expect(collection.search('19', true)).to.eql(false);
expect(collection.search(27)).to.eql('number');
expect(collection.search('27')).to.eql('number');
expect(collection.search('27', true)).to.eql(false);

expect(collection.search(item => item === 19)).to.eql('number');
expect(collection.search(item => item === 27)).to.eql('number');
});

it('should accept a custom callback and return the first value that passes', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/methods/skipUntil_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = (it, expect, collect) => {
it('should work with collection based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
});

Expand All @@ -37,14 +37,14 @@ module.exports = (it, expect, collect) => {
expect(collection.skipUntil('Darwin Núñez').all()).to.eql({
club: 'Liverpool FC',
name: 'Darwin Núñez',
number: 10,
number: 27,
});
});

it('should work when multidimentional', () => {
const data = [{
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
}, {
name: 'Mohamed Salah',
Expand Down
10 changes: 5 additions & 5 deletions test/methods/skipWhile_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ module.exports = (it, expect, collect) => {
it('should work with collection based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
});

expect(collection.skipWhile('Liverpool FC')).to.eql(collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
}));
expect(collection.skipWhile('Liverpool FC').all()).to.eql({
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
});

expect(collection.skipWhile('Darwin Núñez').isNotEmpty()).to.eql(true);
expect(collection.skipWhile('Darwin Núñez').all()).to.eql({
club: 'Liverpool FC',
number: 10,
number: 27,
});
});

it('should work when multidimentional', () => {
const data = [{
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
}, {
name: 'Mohamed Salah',
Expand Down
8 changes: 4 additions & 4 deletions test/methods/takeUntil_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ module.exports = (it, expect, collect) => {
it('should work with collection based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
});

expect(collection.takeUntil('Liverpool FC')).to.eql(collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
}));
expect(collection.takeUntil('Liverpool FC').all()).to.eql({
name: 'Darwin Núñez',
number: 10,
number: 27,
});

expect(collection.takeUntil('Darwin Núñez').isEmpty()).to.eql(true);
Expand All @@ -42,7 +42,7 @@ module.exports = (it, expect, collect) => {
it('should work when multidimentional', () => {
const data = [{
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
}, {
name: 'Mohamed Salah',
Expand Down
4 changes: 2 additions & 2 deletions test/methods/takeWhile_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = (it, expect, collect) => {
it('should work with collection based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
});

Expand All @@ -38,7 +38,7 @@ module.exports = (it, expect, collect) => {
it('should work when multidimentional', () => {
const data = [{
name: 'Darwin Núñez',
number: 10,
number: 27,
club: 'Liverpool FC',
}, {
name: 'Mohamed Salah',
Expand Down
4 changes: 2 additions & 2 deletions test/methods/take_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = (it, expect, collect) => {
it('should work when the collection is based on an object', () => {
const collection = collect({
name: 'Darwin Núñez',
number: 19,
number: 27,
club: 'Liverpool FC',
});

Expand All @@ -32,7 +32,7 @@ module.exports = (it, expect, collect) => {

expect(collection.all()).to.eql({
name: 'Darwin Núñez',
number: 19,
number: 27,
club: 'Liverpool FC',
});
});
Expand Down

0 comments on commit 84ad447

Please sign in to comment.