Skip to content

Instantly share code, notes, and snippets.

@gaelollivier
gaelollivier / sagas-example.js
Created October 24, 2016 21:21
Examples of Snapshot testing a Redux Saga
/**
* Basic saga that revokes session and redirects to /login
* each time a LOGOUT action is dispatched
*/
function* logoutSaga() {
while (true) {
yield take(LOGOUT)
yield put(revokeSession())
yield put(redirect('/login'))
}
@Yimiprod
Yimiprod / difference.js
Last active April 5, 2024 13:17
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {