How to use the lowerFirst function from lodash

Find comprehensive JavaScript lodash.lowerFirst code examples handpicked from public code repositorys.

lodash.lowerFirst is a function that returns a new string with the first character of the given string converted to lower case.

240
241
242
243
244
245
246
247
248
249
module.exports.keysIn              = _.keysIn;
module.exports.kv                  = _.kv;
module.exports.last                = _.last;
module.exports.lastIndexOf         = _.lastIndexOf;
module.exports.lowerCase           = _.lowerCase;
module.exports.lowerFirst          = _.lowerFirst;
module.exports.lt                  = _.lt;
module.exports.ltContrib           = _.ltContrib;
module.exports.lte                 = _.lte;
module.exports.lteContrib          = _.lteContrib;
fork icon19
star icon122
watch icon0

+ 92 other calls in file

653
654
655
656
657
658
659
660
661
662
      return 'Your relationship cannot contain a Java reserved keyword';
    }
    return true;
  },
  message: 'What is the name of the relationship?',
  default: response => _.lowerFirst(response.otherEntityName),
},
{
  when: response => response.relationshipAdd === true,
  type: 'list',
fork icon5
star icon23
watch icon0

+ 7 other calls in file

How does lodash.lowerFirst work?

lodash.lowerFirst is a function that takes a string as an argument and returns the same string with the first character converted to lowercase, while leaving the rest of the characters untouched. It works by using the String.prototype.toLowerCase() method to convert the first character to lowercase and then concatenating it with the rest of the original string.

808
809
810
811
812
813
814
815
816
817
818
819
820
console.log(kebabCase); // => 'foo-bar'


const lowerCase = _.lowerCase('--Foo-Bar--');
console.log(lowerCase); // => 'foo bar'


const lowerFirst = _.lowerFirst('Fred');
console.log(lowerFirst); // => 'fred'


const pad = _.pad('abc', 8);
console.log(pad); // => '  abc   '
fork icon0
star icon4
watch icon0

+ 15 other calls in file

Ai Example

1
2
3
4
5
6
7
const _ = require("lodash");

const str1 = "HELLO";
const str2 = "Hello World";

console.log(_.lowerFirst(str1)); // Output: "hELLO"
console.log(_.lowerFirst(str2)); // Output: "hello World"

In the example above, we first import the lodash library and then define two strings. We then pass each of these strings to _.lowerFirst() and log the result to the console. The _.lowerFirst() function converts the first character of a string to lowercase, and returns the modified string.

Other functions in lodash

Sorted by popularity

function icon

lodash.get is the most popular function in lodash (7670 examples)