Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new helpers for square root, word count, random string #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

djunehor
Copy link

@djunehor djunehor commented Oct 2, 2019

  • helper function to return square root of a number
  • helper function to count number of words in a word
  • helper function to split a string to an array
  • helper function to return random string of specified length

*
* @returns {number}
*/
function nombalasan (args) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use camel casing. nonbaLasan

*
* @returns {number}
*/
function igunmerin (args) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use camel casing. square root is Irìn kejì in yoruba

@@ -0,0 +1,18 @@
/** Takes any number
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add test cases for each of these methods

var result = "";
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use let for block variables

*/
function yipooro (args) {
if (Array.isArray(args)) {
let [ length, ] = args;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const is preferred in yorlang codebase whenever a variable is not re-assigned

*
* @returns {number}
*/
function iyeoro (args) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use lowerCamelCasing

* @param {string} str - receives a string and returns the length
* @returns number
*/
function pipoto (args) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already an helper method ka that does this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing helper function ka is to count number of elements in an array. This helper pipoto is to count the length of a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants