More information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
// Iterate over each item of an array
[1, 2, 3, 4].forEach(item => console.log(item))
it("returns 400", async () => { | |
const { statusCode } = await queryApi("POST", "/products", { body: {} }); | |
expect(statusCode).to.equal(400); | |
}); |
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
const Sequelize = require("sequelize"); | |
const env = process.env.NODE_ENV || "development"; | |
const conf = require(path.resolve(__dirname, "conf", env)); | |
const sequelize = new Sequelize( | |
conf.db.database, | |
conf.db.username, |
const express = require("express"); | |
const app = express(); | |
// code will go here | |
module.exports = app; |
function sanitize(object) { | |
if (_.isString(object)) return _sanitizeString(object); | |
if (_.isArray(object)) return _sanitizeArray(object); | |
if (_.isPlainObject(object)) return _sanitizeObject(object); | |
return object; | |
} | |
function _sanitizeString(string) { | |
return _.isEmpty(string) ? null : string; | |
} |
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
More information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
// Iterate over each item of an array
[1, 2, 3, 4].forEach(item => console.log(item))
angular | |
.module('app.moduleA', ['app.moduleB']) | |
.factory('FactoryA', (FactoryB) -> | |
factory = {} | |
factory.sayHello = () -> FactoryB() | |
return factory | |
) |
const Hapi = require('hapi') | |
function createServer({conf, controllers}) { | |
const server = new Hapi.Server() | |
server.connection(conf) | |
app.routes([ | |
{ | |
method: 'GET', | |
path: '/users', |
const bcrypt = require('bcrypt') | |
exports.encrypt = plainTextPassword => new Promise((resolve, reject) => { | |
bcrypt.hash(plainTextPassword, 10, (err, hash) => { | |
if (err) return reject(err) | |
return resolve(hash) | |
}) | |
}) | |
exports.compare = (plainTextPassword, hash) => new Promise((resolve, reject) => { |
git branch -a --merged=master |