当前位置:网站首页>NPM basic use
NPM basic use
2022-07-27 18:59:00 【venture to ask】
1、 install
- npm It is a module sharing community all over the world , You can use the modules developed by others in this community for free .
Community address :https://www.npmjs.com/
Only care about how to use , Don't worry about how to package , Because they may also be introducing other modules when packaging
2、 Use
- Open the website Query the keyword of the module you need in the search box
Let's say 1234567 Intelligent conversion to uppercase search “ Capitalization ”
Because of the installation NodeJS It was already installed at the time of npm Package manager , So you can use ; For example, we found one nzh Module , You need to use npm Command to install npm install nzh
At this time, refer to the provided API To use nzh Reference documents

var Nzh = require("nzh");
console.log(Nzh.cn.encodeS(100111))// Turn to Chinese lowercase
console.log(Nzh.cn.encodeB(100111))// Capitalize in Chinese
console.log(Nzh.cn.encodeS(1.23456789e+21))// Scientific notation string
console.log(Nzh.cn.toMoney(100111.11))// Transfer amount in Chinese 
Small cases Date conversion
var http = require("http")
var solarLunar = require('solarLunar')
var server = http.createServer(function (req,res) {
// Character set
res.setHeader("Content-type","text/html;charset=UTF8")
let arr = req.url.match(/\/(.+)\/(.+)\/(.+)$/)
let $1 = arr[1];
let $2 = arr[2];
let $3 = arr[3];
console.log($1,$2,$3)
var gl = solarLunar.solar2lunar($1,$2,$3) // The entered date is the Gregorian calendar
var nl = solarLunar.lunar2solar($1,$2,$3) // The entered day is the lunar calendar
res.end(`<h1> This year is ${gl.cYear} year ${gl.cMonth} month ${gl.cDay}${gl.animal} year </h1>`)
})
server.listen(3000)
边栏推荐
- WinForm remove the close button in the upper right corner
- [NPM] the "NPM" item cannot be recognized as the name of cmdlets, functions, script files or runnable programs. Please check the spelling of the name. If the path is included, make sure the path is co
- PyGame aircraft war game background implementation
- MySQL 05 存储过程
- 【微信小程序】项目实战—抽签应用
- Filebeat.yml configuration file about the configuration of multiple services
- 我人都傻了,CompletableFuture和OpenFegin一起使用竟然报错
- js中的函数与DOM获取元素和事件属性的使用
- Aircraft battle with enemy aircraft
- 模仿线程扣除
猜你喜欢
随机推荐
Leetcode first day of question brushing
Talking about JVM (frequent interview)
Product recommendation and classified product recommendation
Some advice for NS2 beginner.
Full automatic breast pump chip dltap703sd
The hero of the aircraft war comes out with bullets
功率单位(power control)
Unity显示Kinect捕获的镜头
CMD command
飞机大战碰撞检测
我人都傻了,CompletableFuture和OpenFegin一起使用竟然报错
Household mute mosquito repellent lamp chip-dltap703sd-jericho
npm 基本使用
瑞吉外卖笔记
MySQL 05 存储过程
Set the arc button to be displayed in the middle
I'm stupid. When completable future is used with openfegin, it even reports an error
Redis注解
订单的提交
Whole body multifunctional massage instrument chip-dltap602sd







