Git Product home page Git Product logo

ganon's Introduction

Logo

Ganon is a javascript library designed and maintained by open source contributors.

Build Status npm License Downloads


A HUGE THANKS!!

A very special thanks to @csleong98 for designing our logo!

Huge props to @andreasgruenh and @ktilcu for helping collaborate.

And the biggest of credit goes to all of our awesome Contributors!!

Usage

$ yarn add ganon

NodeJS

// import { sum } from 'ganon';
const { sum } = require('ganon');

const sumOfOneAndTwo = sum(1, 2);
=> 3

Javascript

// import sum from 'ganon/dist/sum';
const sum = require('ganon/dist/sum');

const sumOfOneAndTwo = sum(1, 2);
=> 3

Objective

To build a suite of javascript methods by the time hacktoberfest ends! Let's get some T-shirts!!

Ganon is designed to get as many people involved as possible, so our objective here is to fix or improve an existing method and then write the skeleton of a desired method for someone else to build. In the spirit of getting everyone involved, please only fix one or two methods at a time and make sure to push up something for someone else to work on!

This project was created to have fun.

Project Structure

All methods will live in the lib directory of the project. They should be written as [methodName].js, required and exported in lib/index.js.

All tests will live in the test directory. A test file should be formatted [methodName].test.js to reflect what method is being tested.

Contributing

Please read our Contributing Guide for information on how to contribute to this project! All skill levels are more than welcome to participate in this project!

Demo

We're going to walk through the process of taking on an issue, resolving it, writing a new issue, and shipping some code.

The method we are going to resolve is called sum:

// lib/sum.js

function sum(a, b) {
// Your code goes here.
}

module.exports = sum;

In order to test this method, we will first run yarn test sum:

$ yarn test sum

  FAIL  problems/sum.test.js
    ✕ adds 1 + 2 to equal 3 (8ms)
    ✕ adds 3 + 4 to equal 7 (1ms)

    ● adds 1 + 2 to equal 3

      expect(received).toBe(expected)

      Expected value to be (using ===):
        3
      Received:
        undefined

As you can see, there is something wrong with the function sum, so let's resolve it:

// lib/sum.js

function sum(a, b) {
  return a + b;
}

module.exports = sum;

Run the test again:

$ yarn test sum

  PASS  problems/sum.test.js
    ✓ adds 1 + 2 to equal 3 (6ms)
    ✓ adds 3 + 4 to equal 7 (1ms)

Now that I have fixed the sum function to return the desired value, I need to write the skeleton of a new method for other contributors to work on. Let's write one called difference:

// lib/difference.js

// Write a function that returns the difference of the first two parameters

function difference(a, b) {
// Your code goes here.
}

module.exports = difference;

We will need to accompany this method with a test(s) to ensure it returns the proper value:

// test/difference.test.js

const { difference } = require("../lib");

describe("difference", () => {
  test("subtracts 1 - 3 to equal -2", () => {
    expect(difference(1, 3)).toBe(-2);
  });

  test("subtracts 10 - 3 to equal 7", () => {
    expect(difference(10, 3)).toBe(7);
  });
});

Now that we have fixed a method, written the skeleton of a new method, and a test to accompany it, we can push up our changes and open a pull request. 🔥 🔥 🔥

ganon's People

Contributors

5hanth avatar aaronjlech avatar amoradi avatar blakeguilloud avatar brycereynolds avatar conradreuter avatar damjanh avatar dna113p avatar doubledare704 avatar edgardmota avatar grigori-gru avatar hugoduraes avatar j4unty avatar jamesg1 avatar jbharat avatar jhdoak avatar jonaylor89 avatar josephmcasey avatar jsjain avatar ksjc1995 avatar ktilcu avatar lsboss avatar ltetzlaff avatar luisvillalba avatar mtso avatar nyrkuredla avatar sebassdc avatar stillnovice avatar tomasswood avatar wulingoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ganon's Issues

Fix Remainder method

There is currently a method called remainder that lives in /lib/remainder.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test remainder results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix Ceiling Method

There is currently a method called ceiling that lives in /lib/ceiling.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test ceiling results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Setup a precommit-hook for linting

We need to prevent people from committing code that doesn't follow our linting rules, as we already have 34 eslint errors! We should implement a hook that runs when a user attempts to commit code to make sure they have followed all of our rules.

I do not know much about precommit hooks, but from my understanding there are plenty of packages out there to solve this issue- this is the first one I found:
precommit-hook-eslint

Acceptance Criteria

  1. When a user runs git commit -m 'message here', the command yarn lint runs.
  2. If the linter passes, the user's commit goes through.
  3. If the linter fails, the user's commit does not go through.

Unfortunately setting up this task properly requires the contributor to also resolve all of the existing linter errors, but should prevent this from happening in the future!

Fix Contain method

There is currently a method called contain that lives in /lib/contain.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test contain results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Quotient method

There is currently a method called Quotient that lives in /lib/quotient.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test quotient results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

fix decrement function

There is currently a method called decrement that lives in /lib/decrement.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test decrement results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

firstUniqueChar Method

There is currently a method called firstUniqueChar that lives in /lib/firstUniqueChar.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test firstUniqueChar results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Exponent method

There is currently a method called exponent that lives in /lib/exponent.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test exponent results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix and function

Function should return true if both arguments are true; false otherwise.

Acceptance Criteria:

  • 'yarn test and' should pass

Feedback

For anyone who thinks of ideas to improve what I am trying to accomplish here, or just has a comment about it! I hope the README was clear enough!

Fix Pythagorean method

There is currently a method called pythagorean that lives in /lib/pythagorean.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test pythagorean results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix floor method

There is currently a method called floor that lives in /lib/floor.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test floor results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Product method

There is currently a method called product that lives in /lib/product.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test product results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Sum method.

There is currently a method called Sum that lives in /lib/sum.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test sum results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix isOdd method

There is currently a method called isOdd that lives in /lib/isOdd.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test isOdd results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Improve Existing Methods

There are plenty of methods that could be improved upon, more clearly documented, or contain a better suite of tests surrounding them. Please feel free to jump in and help clean up some existing methods where you see fit!

Two great examples of well documented methods with great tests surrounding them are permute.js and combinations.js. Shoutout to @andreasgruenh for the work he did surrounding these features.

The same rule applies for improving methods in that when you create a pull request, if you can, please be sure to accompany it with a skeleton method for someone else to work on!!

Fix Rot13 method

There is currently a method called rot13 that lives in /lib/rot13.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test rot13 results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Fix UpperCase method

There is currently a method called upperCase that lives in /lib/upperCase.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test upperCase results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Xor method

There is currently a method called xor that lives in /lib/xor.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test xor results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Difference method.

There is currently a method called difference that lives in /lib/difference.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test difference results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Implement a linter to enforce code style

We need to bring in a tool like eslint to make sure we maintain a certain style for this codebase. I'd like the initial implementation to be very basic and discussions surrounding rules can take place in this issue.

Acceptance Criteria:

  1. Running yarn lint should lint the codebase and print errors where they are found.

Fix clamp method

There is currently a method called clamp that lives in /lib/clamp.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test clamp results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Remove .DS_Store files and gitignore them

Remove .DS_Store files since it doesn't make sense to have it in the repo, it should be ignored as well

Acceptance Criteria:

None .DS_Store should be in the repo

Fix EndsWith method

There is currently a method called endsWith that lives in /lib/endsWith.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test endsWith results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Fix the Square method

There is currently a method called square that lives in /lib/square.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test square results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix Nor function.

There is currently a method called nor that lives in /lib/nor.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test nor results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix RemoveLast function

There is currently a method called removeLast that lives in /lib/removeLast.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test removeLast results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix SwapCase method

There is currently a method called swapCase that lives in /lib/swapCase.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test swapCase results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix fibonacci method || test

There is currently a method called fibonacci that lives in /lib/fibonacci.js.
Something is wrong and the test is failing! I could use a hand figuring out what's going on- it could be the test itself.

Acceptance Criteria:

  1. Running yarn test fibonacci results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix indexOf method

There is currently a method called indexOf that lives in /lib/indexOf.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test indexOf results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Fix isEven method

There is currently a method called isEven that lives in /lib/isEven.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test isEven results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Fix Average method

There is currently a method called average that lives in /lib/average.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test average results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix prime function

There is currently a method called prime that lives in /lib/prime.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test prime results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Create our logo!!

It's a silly request, but I thought I would throw it out there! It would be awesome if we had some sort of logo to represent the project. I know absolutely nothing about designing or shipping a logo, so this is completely up to the contributor! Feel free to take it however you would like.

Fix Median method

There is currently a method called median that lives in /lib/median.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test median results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix SquareRoot method

There is currently a method called squareRoot that lives in /lib/squareRoot.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test squareRoot results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix without function

There is currently a method called without that lives in /lib/without.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test without results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Clean up the README

We currently have a single README containing all of our documentation. This should be broken out into chunks to make it easier for Contributors to contribute and for Users to consume.

This will involve:

  1. Our Objective
  2. Documentation on how to install and use the package in other projects.
  3. A CONTRIBUTING.md

Fix "sign" method

There is currently a method called sign that lives in /lib/sign.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test sign results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Fix Reverse function

There is currently a method called reverse that lives in /lib/reverse.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test reverse results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Updates to Travis CI

So I merged in a travis CI config and realized it may be counter intuitive in this project. The objective of this project is to have broken tests for someone else to fix. So the build should always fail.

Does anyone know if there are ways to configure travis to run our linter instead of run tests?

cc. @shawnhwei

Fix Factorial method

There is currently a method called factorial that lives in /lib/factorial.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test factorial results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Add linting rule for quotes

Many pull requests use different forms of quotes, this problem can be fixed with a linting rule

We want all quotes to use double quotes (") except the places, where template literals (`) are used for templates.

Acceptance Criteria:

  • Running yarn run lint should not yield any errors after adding the quotes rule.

Fix fibonacci method

There is currently a method called fibonacci that lives in /lib/fibonacci.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test fibonacci results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

asdf

There is currently a method called endsWith that lives in /lib/endsWith.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test endsWith results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix Alphabetize function

There is currently a method called alphabetize that lives in /lib/alphabetize.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test alphabetize results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix Last method

There is currently a method called last that lives in /lib/last.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test last results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix Increment method

There is currently a method called increment that lives in /lib/increment.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test increment results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix gcd method

There is currently a method called gcd that lives in /lib/gcd.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test gcd results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Fix the Abs method

There is currently a method called Abs that lives in /lib/abs.js.
It is incomplete and needs to be fixed!

Acceptance Criteria:

  1. Running yarn test abs results in tests passing.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.