function replaceAliases( match, pkg ) {
			var alias;
			var key;
			var len;
			var o;
			var i;

			alias = pkg2alias( pkg );
			alias = alias.split( '.' );
			len = alias.length;

			// TODO: use @stdlib/utils/deep-set once refactored!
			o = scope;
			for ( i = 0; i < len; i++ ) {
				key = alias[ i ];
				if ( i < len-1 ) {
					if ( !hasOwnProp( o, key ) ) {
						o[ key ] = {};
					}
					o = o[ key ];
				} else {
					o[ key ] = require( pkg ); // eslint-disable-line stdlib/no-dynamic-require
				}
			}
			return alias.join( '.' );
		}
Replaces aliases to other packages in REPL example code and registers the respective packages in the runtime context.

@private
@param {string} match - full match
@param {string} pkg - package path
@returns {string} variable name