New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

zrl-test

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zrl-test

时间格式化 html转义

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

安装

、、、 npm install zrl-test 、、、

导入

、、、 const t=require('zrl-test'); 、、、

格式化时间

、、、 function dateformate(str){ let t=new Date(str);

let y=t.getFullYear();
let m=addZero(t.getMonth()+1);
let d=addZero(t.getDate());

let hh=addZero(t.getHours());
let mm=addZero(t.getMinutes());
let ss=addZero(t.getSeconds());

return `${y}-${m}-${d} ${hh}:${mm}:${ss}`

} function addZero(str){ return str>9?str:'0'+str; }

、、、

转义html

··· function htmlEnescpe(htmlstr){ return htmlstr.replace(/>|<|"|&/g,(item)=>{ switch(item){ case '>': return '>' case '<': return '<' case '"': return '"' case '&': return '&'

	}
})

}

、、、

Keywords

itheima

FAQs

Package last updated on 30 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts