Full Disclosure: I'm a member of the AVA team
I should start by saying there are lots of reasons to choose AVA, and I don't think speed is (necessarily) the most import one. Other good reasons include:
// instanceof is a prototype identity check. | |
// NOT a type check. | |
// That means it lies across execution contexts, | |
// when prototypes are dynamically reassigned, | |
// and when you throw confusing cases like this | |
// at it: | |
function foo() {} | |
const bar = { a: 'a'}; |
❯ rollup --version | |
rollup version 0.25.3 | |
❯ time rollup -c ./rollup.js | |
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total | |
❯ time webpack | |
Hash: ebb00bbccd954c114d3c | |
Version: webpack 2.0.7-beta | |
Time: 3623ms |
// Composition Example | |
// http://codepen.io/ericelliott/pen/XXzadQ?editors=001 | |
// https://gist.github.com/ericelliott/fed0fd7a0d3388b06402 | |
const distortion = { distortion: 1 }; | |
const volume = { volume: 1 }; | |
const cabinet = { cabinet: 'maple' }; | |
const lowCut = { lowCut: 1 }; | |
const inputLevel = { inputLevel: 1 }; |
// Class Inheritance Example | |
// NOT RECOMMENDED. Use object composition, instead. | |
// https://gist.github.com/ericelliott/b668ce0ad1ab540df915 | |
// http://codepen.io/ericelliott/pen/pgdPOb?editors=001 | |
class GuitarAmp { | |
constructor ({ cabinet = 'spruce', distortion = '1', volume = '0' } = {}) { | |
Object.assign(this, { | |
cabinet, distortion, volume |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
var RecursiveChildComponent = React.createClass({ | |
render() { | |
return <div> | |
{this.recursiveCloneChildren(this.props.children)} | |
</div> | |
}, | |
recursiveCloneChildren(children) { | |
return React.Children.map(children, child => { | |
if(!_.isObject(child)) return child; | |
var childProps = {someNew: "propToAdd"}; |
let animal = { | |
animalType: 'animal', | |
describe () { | |
return `An ${this.animalType} with ${this.furColor} fur, | |
${this.legs} legs, and a ${this.tail} tail.`; | |
} | |
}; | |
let mouseFactory = function mouseFactory () { |
let animal = { | |
animalType: 'animal', | |
describe () { | |
return `An ${this.animalType}, with ${this.furColor} fur, | |
${this.legs} legs, and a ${this.tail} tail.`; | |
} | |
}; | |
let mouse = Object.assign(Object.create(animal), { |
Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:
NB: Check out git subtree
/git submodule
and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.
Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.