1.0.4 • Published 2 years ago

lightref v1.0.4

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

lightref

npm version

Pass primitive types to javascript functions, by reference.

Passed by value

let myVal = "hello"

testFunction(myVal);

function testFunction(val: string) {
    val += " world";
}

console.log(myVal);
// Output: "hello"

Passed by reference

import { Deref, Ref} from "lightref";

const myRef = Ref<string>("hello");

testFunction(myRef);

function testFunction(ref: Ref<string>) {
    ref.value += " world";
}

console.log(myRef.value);
// Output: "hello world"

1.0.4

2 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago