master 2.2.0
yutent 2023-06-20 18:50:57 +08:00
parent c89fff71d9
commit 1285c266c6
5 changed files with 13 additions and 23 deletions

View File

@ -6,20 +6,10 @@
const Es = require('esbuild')
Es.build({
entryPoints: ['src/index.mjs'],
outfile: 'dist/index.mjs',
platform: 'node',
bundle: true,
minify: true,
format: 'esm'
})
Es.build({
entryPoints: ['src/index.mjs'],
outfile: 'dist/index.js',
platform: 'node',
minify: true,
bundle: true,
target: 'node8'
target: 'es6'
})

View File

@ -1,6 +1,6 @@
{
"name": "es.shim",
"version": "2.1.1",
"version": "2.2.0",
"description": "实现部分新API, 以及一些常用的扩展方法",
"keyworks": [
"es5",

View File

@ -41,7 +41,7 @@ if (!Date.prototype.getFullWeek) {
if (!Date.prototype.format) {
Object.defineProperty(Date.prototype, 'format', {
value: function (str) {
var dt = {
let dt = {
fullyear: this.getFullYear(),
year: this.getYear(),
fullweek: this.getFullWeek(),
@ -53,7 +53,7 @@ if (!Date.prototype.format) {
minutes: this.getMinutes(),
seconds: this.getSeconds()
}
var reg = null
let reg = null
str = str || 'Y-m-d H:i:s'
dt.g = dt.hours > 12 ? dt.hours - 12 : dt.hours

View File

@ -28,7 +28,7 @@ if (!Object.empty) {
if (!Object.prototype.toParams) {
Object.defineProperty(Object.prototype, 'toParams', {
value: function () {
var params = ''
let params = ''
for (let k in this) {
if (this[k] === void 0) {
continue

View File

@ -127,7 +127,7 @@ if (!String.prototype.escape) {
if (!String.prototype.at) {
Object.defineProperty(String.prototype, 'at', {
value: function (num) {
var n = +num
let n = +num
if (n < 0) {
n += this.length
}
@ -144,12 +144,12 @@ if (!String.prototype.at) {
if (!String.prototype.toJson) {
Object.defineProperty(String.prototype, 'toJson', {
value: function () {
var str = this.replace(/^\?/, '')
var params = decodeURIComponent(str)
let str = this.replace(/^\?/, '')
let params = decodeURIComponent(str)
.split('&')
.filter(_ => _)
.map(_ => _.split('='))
var obj = {}
let obj = {}
for (let it of params) {
obj[it[0]] = it[1] || ''
}