LEAVE YOUR VOTE HERE: https://www.surveymonkey.com/s/CGKJ8QF
Click an image to enlarge.
| Image 1 | Image 2 | Image 3 |
|---|---|---|
![]() |
![]() |
![]() |
| Image 4 | Image 5 | Image 6 |
|---|
| function getUniqueKeys() { | |
| var keys = []; | |
| _.forEach(behaviors, function (behavior) { | |
| keys.push(Object.keys(behavior.parametersTemplate)); | |
| }.bind(this)); | |
| return _.uniq(_.flatten(keys)); | |
| } | |
| // OR |
Click an image to enlarge.
| Image 1 | Image 2 | Image 3 |
|---|---|---|
![]() |
![]() |
![]() |
| Image 4 | Image 5 | Image 6 |
|---|
| const _ = require('lodash'); | |
| const stampit = require('stampit'); | |
| const isStamp = require('stampit/isStamp'); | |
| const Tracked = stampit() | |
| .composers(({composables, stamp}) => { // declaring a composer | |
| console.log(`Composed a stamp "${stamp}" from the following: | |
| "${composables.join()}"`); | |
| }); |
| const stampit = require('stampit'); | |
| const ProtectMethodCollisions = stampit({ | |
| statics: { | |
| protectMethodCollisions(name) { | |
| if (this.compose.methods && this.compose.methods[name]) { | |
| const method = this.compose.methods[name]; | |
| function collisionProtectedMethodWrapper() { | |
| return method.apply(this, arguments); | |
| } |
| import compose from '@stamp/compose'; | |
| import Privatize from '@stamp/privatize'; | |
| import Collision from '@stamp/collision'; | |
| const Password = compose({ | |
| properties: { | |
| password: '12345qwert' | |
| }, | |
| methods: { | |
| getPassword() { |
| const express = require('express'); | |
| const path = require('path'); | |
| const logger = require('morgan'); | |
| const cookieParser = require('cookie-parser'); | |
| const bodyParser = require('body-parser'); | |
| const http = require('http'); | |
| const debug = require('debug')('my-app-name:server'); | |
| // Application | |
| const app = express(); |
| module.exports = require('@stamp/it')({ | |
| props: { | |
| express: require('express'), | |
| path: require('path'), | |
| logger: require('morgan'), | |
| cookieParser: require('cookie-parser'), | |
| bodyParser: require('body-parser'), | |
| http: require('http'), | |
| debug: require('debug')('my-app-name:server'), | |
| process, |
| describe('express app setup', () => { | |
| const http = { | |
| createServer() { | |
| return {on() {}, listen() {}}; | |
| } | |
| }; | |
| const App = require('../app2').props({http}); | |
| it('should share ./public', (done) => { | |
| const express = () => ({set() {}, use() {}}); |
| describe('routing', () => { | |
| const App = require('../app2'); | |
| const {handleNotFound, handleGenericError} = App.compose.methods; | |
| it('should set status code to 404 when no route found', (done) => { | |
| handleNotFound({}, {}, (error) => { | |
| if (!error || error.status !== 404) { | |
| throw new Error('Error status should be 404'); | |
| } | |
| done(); |
| describe('server', () => { | |
| const App = require('../app2'); | |
| it('should call exit process after setImmediate()', (done) => { | |
| let errorCallback = null; | |
| let setImmediateCalled = false; | |
| const MockedApp = App.props({ | |
| http: { | |
| createServer() { | |
| return { |