官术网_书友最值得收藏!

Using the utilities of lodash

With the exports in place, we can now take advantage of some of the utilities that come with Lodash. We'll quickly explore two in this section, and we'll be exploring more throughout the book since Lodash is basically just a set of really handy utilities. Before we do, we should take a look at the documentation so we know exactly what we're getting into.

This is a really common step when you're using an npm module: first, you install it; second, you've got to look at those docs and make sure that you can get done what you want to get done.

On the npm page, click the lodash link given there, or go to lodash.com and click the API Documentation page, as shown here:

You can view all of the various methods you have available to you, as shown in the following screenshot:

In our case, we'll be using command + F (Ctrl + F for Windows users) to search for _.isString. Then in the docs, we can click on it, opening it up in the main page, as shown in the following screenshot:

The _.isString is a utility that comes with lodash, and it returns true if the variable you pass in is a string, and it returns false if the value you pass in is not a string. And we can prove that by using it over in Atom. Let's use this.

主站蜘蛛池模板: 明星| 金阳县| 广东省| 襄城县| 酒泉市| 神木县| 福清市| 集贤县| 重庆市| 团风县| 霍林郭勒市| 年辖:市辖区| 贺州市| 牡丹江市| 礼泉县| 寿光市| 洪江市| 吉首市| 漳州市| 玉田县| 读书| 栾城县| 平潭县| 宁河县| 华容县| 新野县| 鄂尔多斯市| 泽库县| 清涧县| 滨海县| 射洪县| 嘉荫县| 曲阜市| 莲花县| 丰镇市| 利辛县| 呈贡县| 当阳市| 阿克苏市| 桂阳县| 沽源县|