A simple stub creating program, creating nested functions and properties
The stub method receives a string defining the stub and a return value, e.g. stub('a.b.c.d', 1) \\ a.b.c.d is equal to 1
Create a stub with single property
let a = stub('b', 1)
console.log(a.b) // 1
Create a stub with multiple nested properties
let a = stub('b.c.d.e', 1)
console.log(a.b.c.d.e) // 1
You can also call functions
let a = stub('b()', 1)
console.log(a.b()) // 1
and nested functions
let a = stub('b().c().d()', 1)
console.log(a.b().c().d()) // 1
You can use functions and objects
let a = stub('b.c().d.e()', 1)
console.log(a.b.c().d.e()) // 1
Feel free to contribute, just fork this repo, make the changes and submit a PR with the changes. Make sure to describe the changes you made, and adress/link any issues or discussion about the changes.
- Cezar Mauricio - czrm
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details