diff --git a/src/dates/index.js b/src/dates/index.js index 91cdc8e..30afd0c 100644 --- a/src/dates/index.js +++ b/src/dates/index.js @@ -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 = { diff --git a/src/numbers/index.js b/src/numbers/index.js index 014b8ca..9c9d7a4 100644 --- a/src/numbers/index.js +++ b/src/numbers/index.js @@ -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 } diff --git a/src/strings/index.js b/src/strings/index.js index eee93b9..58dfc40 100644 --- a/src/strings/index.js +++ b/src/strings/index.js @@ -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 }