Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Collect.js dump() Method

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The dump() method in collect.js is used to print the data at particular moment and then continue further executing the code.

Syntax:

collect.dump()

Parameters: It does not accept any parameters.

Return Value: It does not return any value.

Example 1:

Javascript




// Importing the collect.js module
const collect = require('collect.js'); 
let array = ["a", "b", "c"];
  
// Making the collection
let collection= collect(array);
  
// Using dump() method to print
// the data at this moment
collection.dump()

Output:

Collection { items: [ 'a', 'b', 'c' ] }

Example 2:

Javascript




// Importing the collect.js module.
const collect = require('collect.js');
  
let array = ["a", "b", "c", "d", "e"];
  
// Making the collection
let collection = collect(array);
  
// Using dump() method to print
// the data at this moment
collection.dump()
    .filter((v, k) => v >= "c")
    .dump()

Output:

Collection { items: [ 'a', 'b', 'c', 'd', 'e' ] }
Collection  { items: [ 'c', 'd', 'e' ] }

Reference: https://collect.js.org/api/dump.html

My Personal Notes arrow_drop_up
Last Updated : 29 Jul, 2020
Like Article
Save Article
Similar Reads
Related Tutorials