You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

shadow.js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shadow.js

"# My project's README"

1.0.2
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

API

get(key:string)

Get the current value and all other remaining value

watch(key:string)

Get any new values that are set

also(...keys:string[])

If you want to watch more properties. You can do that

Examples as Test Cases

import "rxjs/add/operator/take"
import "rxjs/add/operator/finally"
import {expect} from "chai"
import { Shadow } from 'shadow.js';

describe("Shadow",()=>{

    function setup(){
        return Shadow.create({
            name:"Shavyg",
            age:27
        })
    }

    let person = setup();

    beforeEach(()=>person=setup());


    //you can watch for a propert change on anything

    it("Should be able to watch shaded properties",(done)=>{
        Shadow(person).watch("name").subscribe(()=>{
            done();
        });
        person.name = "Pizza";
        person.age = 1000;
    })




    it("Should be able to get shaded properties",(done)=>{
        Shadow(person).get("name").take(2).finally(done).subscribe();
        person.name = "Pizza";
        person.age = 1000;
    })


    it("should be able to shadow new properties",(done)=>{

        Shadow(person).also("race")

        Shadow(person).watch("race").take(1).subscribe(()=>{
            done();
        });

        (person as any).race = "super";
    })


    afterEach(()=>{
        Shadow(person).clear();
    })

})

FAQs

Package last updated on 21 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts