当前位置:网站首页>Using the third-party built-in module to realize the function of converting numbers to uppercase in nodejs
Using the third-party built-in module to realize the function of converting numbers to uppercase in nodejs
2022-07-19 00:16:00 【A dusty day】
One 、 Case production
Achieve one , The function of converting numbers to uppercase Such as : 123 turn One hundred twenty-three
stay nzh - npm (npmjs.com) Query on npm Document introduction to third-party modules
Find the corresponding package that may be used , Reference documents , Installation , Use

npm Specific usage :
Two 、npm brief introduction
npm Its full name is Node Package Manager, It's based on Node.js Package manager , Also the whole Node.js The most popular in the community 、 The package manager that supports the most third-party modules .npm The purpose of :JavaScript It's easier for developers to share and reuse code .
nodejs = ECMAScript + Core module
Follow by yourself commonjs Write modules according to the specification , If you write a function module ( Date processing datejs, Digital processing numberjs). If you can share these modules , Who wants to develop related functions in the future , Take the developed module directly and use it , There is no need to develop by yourself . There is a website on the internet dedicated to collecting such toolkits .npm Chinese document | npm Chinese net .
If we want to use the package in this website , Then we need to use a function , be called npm.
Official website :npm Chinese document | npm Chinese net
npm Can be used to :
Allow users to obtain third-party packages and use
Allow users to publish and share their own packages or command-line programs
npm install :
npm No need to install separately . In the installation Node When , Will be installed together npm.
Execute the following command to view the locally installed npm Version number of .
npm -v
If you want to upgrade npm , It can be like this .cmd If the interactive mode is not prompted, the upgrade can be ignored
npm install npm --global
3、 ... and 、npm Experience
To install and use md5 Module as an example :
1、 Under project directory , Carry out orders npm init, There will be one more package.json file ( This file 1、 Record project related information , Such as project name , Project version 2、 The third-party modules used in the project will be recorded later )
2、 Under project directory , Carry out orders npm install md5, At this time, you will start downloading online md5 This package , The download process requires patience , The waiting time depends on the network speed .
3、 Seeing the following code indicates that the download is complete :
After downloading : There is one more in the local project directory node_modules Folder , What we just downloaded md5 Packages and their related dependent packages are all in this folder . In the future, we need to download other packages during development , Will be downloaded in this folder .
4、 We build new JS The file should be consistent with node_modules Folders at the same level , Then reference the third-party module in the new file
5、 After downloading, you can import it into the project and use it :
var md5 = require('md5');
console.log(md5("12345789"));Run to get an encrypted string .
边栏推荐
- Redis distributed cache - redis master-slave
- WordPress主题分享:The7主题v10.11免费下载 2022年最新版
- 20220707 thread learning inheritance
- How to improve query efficiency by using virtual columns provided by mysql5.7
- Shell condition judgment exercise
- Atomic class and CAS
- 关于websocket的各种资料的收集
- WordPress Theme sharing: Avada theme v7.8.0 download the latest version in 2022 for free
- Maximum subarray XOR and
- iptables学习笔记
猜你喜欢

Redis distributed cache - redis master-slave

Kept - solve the problem that the primary and standby nodes seize the VIP at the same time

Keepalived——解决 主备节点同时抢占VIP 的问题

Maximum subarray XOR and

2022-07-15 网工进阶(十九)BGP-状态机、对等体之间的交互原则、影响对等体关系建立的因素、对等体表、路由表、详细路由表、路由属性

2022最新汉化camtasia studio电脑录制屏幕工具
![[acwing周赛复盘] 第 60 场周赛20220716](/img/59/38fde90ff1d4221bd35379df1291d1.png)
[acwing周赛复盘] 第 60 场周赛20220716

Interviewer: after working for two years, you can't solve such a simple algorithm problem?

About the use of go modules environment construction and package management tools

The relationship between filedescriptor and open file in liunx
随机推荐
Glide 源码分析(4.13.2)
VisionMaster与优傲机器人 UR5e 进行Modbus通讯
面试官:工作两年了,这么简单的算法题你都不会?
Redis三种模式——主从复制、哨兵模式、集群
iptables学习笔记
Glide source code analysis (4.13.2)
Find all letter ectopic words in the string
数据接入平台(DIP)系列文章之一|功能及架构浅析
关于websocket的各种资料的收集
[acwing周赛复盘] 第 60 场周赛20220716
2022-07-16 第五小組 修身課 學習筆記(every day)
Checked to display and hide the hearts of favorite buttons
WordPress Theme sharing: Avada theme v7.8.0 download the latest version in 2022 for free
微信小程序开发学习3(WXSS模板和全局配置)
Vs publish websites using webdeploy
Delphi 485 Modbus Rtu读写RFID示例源码
Software test interview (II)
Umap introduction and code examples
用cmd命令进行磁盘清理(主要是系统盘)
Easy operation of cloud platform