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
#!/bin/bash | |
# Environment check | |
# If migrating from localhost, set this to localhost | |
if [[ ! $SOURCE_HOST_ADDRESS ]] | |
then | |
echo "Please set the current host address in SOURCE_HOST_ADDRESS" | |
exit 1 | |
fi |
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 interceptFunction = (object, fnName, options) => { | |
const noop = () => {} | |
const fnToWrap = object[fnName] | |
const before = options.before || noop | |
const after = options.after || noop | |
object[fnName] = function (...args) { | |
before.apply(this, args) | |
const result = fnToWrap.apply(this, args) | |
after.apply(this, args, result) |