yahoo / yahoo/serialize-javascript
Support custome object
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 215
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 2
Description
Add support for serialization and deserialization of custom objects via Object.assign and Object.create
For example:
class A {
a = 1
}
serialize(A, { classes: { A } })
get
const serialized = "(function(args) {var k = args[0].classes;return args[0].assign(Object.create(k.A.prototype), { a: 1 })})(arguments)"
function unserialize() {
return eval(serialized)
}
unserialize({ classes: {A: function() {}}, assign: Object.assign })
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's serialize(A, { classes: { A } }) example and compare the requested Object.assign/Object.create path with the package's current behavior. Done means custom objects can be serialized and deserialized while preserving the supplied class prototype and property data; add or run a round-trip test once the relevant entry point is located.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100