czrml / stub

A simple stub creating program, creating nested functions and properties

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stub creation

A simple stub creating program, creating nested functions and properties

Build Status

Definition

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

Usage

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

Contributing

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.

Authors

  • Cezar Mauricio - czrm

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A simple stub creating program, creating nested functions and properties

License:MIT License


Languages

Language:JavaScript 100.0%