protofill: 我在玩火

在 prototype 上修改/添加语言特性,做一些“玩火”的事情
更新于: 2023-08-11 10:50:52
项目主页: https://github.com/afeiship/protofill

背景

我承认,我一直在玩火,很有意思的小工具,我会在自己的一些 “极小的” 项目里使用。

安装

npm install @jswork/protofill

使用

import '@jswork/protofill'

方法列表

期望的 "原编程" 的味道。

成员用法
Array#first
const arr = [1,2,4]
# set
arr.first = 5
# get
arr.first
Array#last
const arr = [1,2,4]
# set
arr.last = 5
# get
arr.last
Date#format
const d = new Date();

console.log(d.format('YYYY-MM-DD HH:mm:ss'));
console.log(d.format('datetime'));
console.log(d.format('date'));