This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
// The entry point for the application is the 'main' function in the 'main' package. | |
// The main function must take no arguments and return no values. | |
func main() { | |
fmt.Println("Hello World") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const mongoose = require('mongoose'); | |
const morgan = require('morgan'); | |
const bodyParser = require('body-parser'); | |
const app = require('express')(); | |
const port = 8000; | |
/** Mongoose Schema setup */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flattenObject = object => { | |
let obj = {}; | |
Object.keys(object).forEach(key => { | |
if (typeof object[key] !== 'object') { | |
obj[key] = object[key]; | |
} else { | |
obj = { ...obj, ...flattenObject(object[key]) }; | |
} | |
}); | |
return obj; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given this Object | |
const obj1 = { | |
one: 1, | |
two: 2, | |
three: { four: 4, five: { six: 6 } }, | |
seven: 7, | |
eight: { nine: 9, ten: 10 }, | |
eleven: { twelve: { thirteen: { fourteen: 14 } } }, | |
}; |
NewerOlder