当前位置:网站首页>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)
边栏推荐
- JDBC MySQL 01 JDBC operation MySQL (add, delete, modify and query)
- Product name fuzzy search:
- WORD 2007+使用技巧
- Whole body multifunctional massage instrument chip-dltap602sd
- MySQL 01 relational database design
- The hero of the aircraft war comes out with bullets
- MySQL 05 存储过程
- LeetCode 刷题 第三天
- MySQL 06 transaction, view, index, backup and recovery
- MySQL 01 关系型数据库设计
猜你喜欢

Uni app form submit button send request

Talking about JVM (frequent interview)

Jianmu continuous integration platform v2.5.2 release

Redis注解

Wechat payment and payment callback

Join query and subquery

Multifunctional wireless remote control moxibustion instrument chip dltap703sd

微信支付及支付回调

LeetCode 刷题 第一天

你想得到想不到的MySQL面试题都在这了(2022最新版)
随机推荐
建木持续集成平台v2.5.2发布
订单超时取消 及 按类别查询商品
Hash、Set、List、Zset、BitMap、Scan
npm、cnpm 淘宝镜像
我人都傻了,CompletableFuture和OpenFegin一起使用竟然报错
商品评论信息与评论信息分类
Redis注解
Low noise anion fan touch IC
MySQL 01 relational database design
express get/post/delete...请求
Household mute mosquito repellent lamp chip-dltap703sd-jericho
The great idea of NS2
Unity显示Kinect捕获的镜头
Arrays and objects in JS
`this.$ Emit ` the child component passes multiple parameters to the parent component
ERROR 1366 (HY000): Incorrect string value: ‘\xE8\xB5\xB5\xE9\x9B\xB7‘ for column ‘s_ name‘ at row 1
MySQL 03 高级查询(一)
Use mobaxtermto establish a two-tier springboard connection
MongoDB
Product recommendation and classified product recommendation