Togethers 在一起
1. Description 说明
Simply put, it's just for the convenience of expression.
When you have several data to bind together, defining classes separately can be cumbersome. That's why I wrote so many public classes.
简单来说,只是为了方便表达。
当你有几个数据需要绑定在一起的时候,单独定义类很麻烦。所以才写了这么几个公共类。
2. Example 例子
import { One, Two, Three, Four, Five } from '../dist/index.js';
const one = new One('one');
console.log(JSON.stringify(one));
const two = new Two('one', 2);
console.log(JSON.stringify(two));
const three = new Three('one', 2, true);
console.log(JSON.stringify(three));
const four = new Four(1, 'two', new Map(), 4.0);
console.log(JSON.stringify(four));
const five = new Five(1, new Map(), new Date(), undefined, null);
console.log(JSON.stringify(five));
console.log(five.d);
Executing the above code will output:
执行上述代码,会输出:
{"a":"one"}
{"a":"one","b":2}
{"a":"one","b":2,"c":true}
{"a":1,"b":"two","c":{},"d":4}
{"a":1,"b":{},"c":"2023-11-04T15:48:21.757Z","e":null}
undefined