Skip to content

ichko/as.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

as.js

require("./as.js");

class Point {
    
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }

    length() {
        return Math.sqrt(this.x * this.x + this.y * this.y);
    }

}

let length = ({x: 4, y: 3}).as(Point).length();
console.log(length); // 5

About

JS cast anonymous object

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published