Skip to content

programadorsemfronteira/functions_use_sample

Repository files navigation

Functions use sample

This is a sample showing how a function can be used to reuse a piece of code.

NOTE: It's just for educational purpose, not a real world application and it doesn't necessary follow all the best development praticies.

It's the result of an article explaing programming logic, in portuguese - O que é lógica de programação afinal?

Running

  • Clone this repository git clone git@github.com:programadorsemfronteira/functions_use_sample.git;
  • Run npm install installing dependencies;
  • Run npm run test verifying the current implementation is working.

The current implementation uses a function called hasAccess shared between modules.

An implementation without using this function is available as well on a previous commit.

Checking out the implementation using the code duplicated on both modules

  • Verify the different commit running git checkout b24115b66f291250dc13b1ebdf0a89f131902f1b
  • Run npm run test verifying the implementation is still working.

NOTE: Once you have done, run git switch - switching back to the main implementation.

About

How functions can be used for code reuse

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors