0.1.6 • Published 2 years ago

@jiuya/ya v0.1.6

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

一个支持 undefined,function,symbol 和循环引用 的 javascript 序列化库。 全局导出 ya.string()ya.parse()

安装:

npm i @jiuya/ya

引入:

import {parse, string} from '@jiuya/ya'
import ya from '@jiuya/ya'

使用:

const obj = {
    a: true,
    b: [1, 2, 3, Symbol.for('apple')],
    c: {
        d: 1,
        e: ({name,    age})    => {
            console.log(name, age)
        },
        h: (...arr) =>      {
            console.log(arr)
        }
    },
    f  (   )   {
        const c = 3
        console.log(1, this, this.a, c)
    },
    g: /123/g,
    i: undefined,
    j: null,
    [Symbol.for('apple')]: Symbol.for('apple'),
    [Symbol.for('pig')]: {
        pig: 15
    }
}
const co = ya.string(obj)
console.log(co, 'co')
const copy = ya.parse(co)
console.log(copy)
0.1.0

2 years ago

1.0.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago