Lodash _.isBuffer() Method
The Lodash _.isBuffer() Method Checks if the given value is Buffer or not.
Syntax:
Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!
_.isBuffer( value )
Parameters: This method accepts a single parameter as mentioned above and described below:
- value: This parameter holds the value that needs to be Checked for Buffer.
Return Value: This method returns a Boolean value( Returns true if the given value is a Buffer, else false).
Example 1: This method returns true when the value is a Buffer.
// Defining Lodash variableconst _ = require('lodash'); var val = new Buffer(2); // Checking for Bufferconsole.log("The Value is Buffer : " +_.isBuffer(val)); |
Output:
The Value is Buffer : true
Example 2:
// Defining Lodash variableconst _ = require('lodash'); var val = new Uint8Array(2); // Checking for Bufferconsole.log("The Value is Buffer : " +_.isBuffer(val)); |
Output:
The Value is Buffer : false


