Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/dates/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
// import moment here; use this package in each function

const today = () => {
const moment = require("moment")

const today = () => {

return moment().format('dddd');
// write code for dates.today

}

const calendar = () => {
return moment().format('ll')
// write code for dates.calendar

}

const currentTime = () => {
// write code for dates.currentTime

return moment().format("hh:mm:ss A");
}

module.exports = {
Expand Down
23 changes: 22 additions & 1 deletion src/numbers/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
const { numbers } = require("..")
const totalled = require("totalled");
const { stubTrue } = require("lodash");

const isEven = (num) => {
// write code for numbers.isEven

if (num % 2 == 0)
return true
}



const sum = (arr) => {
// write code for numbers.sum
let total = totalled(arr)
return total

}





const comboSum = (arr, sum) => {
for (let i = 0; i < arr.length; i ++){
for (let j = i + 1; j < arr.length; j++){
if (arr[i] + arr[j] === 14)
return true
}

}
// write code for numbers.comboSum
return false

}

Expand Down
11 changes: 9 additions & 2 deletions src/strings/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
const split = (str, delim) => {
// write code for strings.split
const src = require("..")

const split = (str) => {
// write code for strings.split
return str.split("-")
}

const pairs = (str) => {
// write code for strings.pairs
return str.match(/(..?)/g)

}

const reverse = (str) => {
let splitString = str.split("")
let reverse = splitString.reverse()
let rejoin = reverse.join("")
return rejoin
// write code for strings.reverse

}
Expand Down