Introduction
What is ReviveJS?
import { revive } from 'revivejs'
class Person {
name = ''
public sayHi() {
console.log(`Hi, I'm ${this.name}.`)
}
}
const data = '{"name": "John Smith"}'
const person = revive(data, Person)
person.sayHi() // Hi, I'm John Smith.
const revivejs = require('revivejs')
function Person(name) {
this.name = name
}
Person.prototype.sayHi = function() { console.log(`Hi, I'm ${this.name}.`) }
const data = '{"name": "John Smith"}'
const person = revivejs.revive(data, Person)
person.sayHi() // Hi, I'm John Smith.Last updated