How to use the shallow function from hoek

Find comprehensive JavaScript hoek.shallow code examples handpicked from public code repositorys.

65
66
67
68
69
70
71
72
73
74
};

// Massage registration config for use with rejoice
internals.registrationConfig = (options) => {

    const config = Hoek.shallow(options);
    delete config.defaults;
    delete config.teardownOnStop;

    // Resolve models
fork icon14
star icon102
watch icon9

81
82
83
84
85
86
87
88
89
90
this.orig = {};
this.params = null;
this.paramsArray = null;                                                                            // Array of path parameters in path order
this.path = null;
this.payload = null;
this.plugins = (options.plugins ? Hoek.shallow(options.plugins) : {});                              // Place for plugins to store state without conflicts with hapi, should be namespaced using plugin name
this.pre = {};                                                                                      // Pre raw values
this.preResponses = {};                                                                             // Pre response values
this.raw = { req, res };
this.response = null;
fork icon0
star icon1
watch icon2

+ 7 other calls in file

209
210
211
212
213
214
215
216
217
218
if (typeof plugin === 'function') {
    if (!plugin.register) {                                 // plugin is register() function
        plugin = { register: plugin };
    }
    else {
        plugin = Hoek.shallow(plugin);                      // Convert function to object
    }
}

if (plugin.register.register) {                             // Required plugin
fork icon0
star icon0
watch icon1

75
76
77
78
79
80
81
82
83
84
const ext = new internals.Ext(type, route._core);

const events = route.settings.ext[type];
if (events) {
    for (let event of events) {
        event = Hoek.shallow(event);
        Hoek.assert(!event.options.sandbox, 'Cannot specify sandbox option for route extension');
        event.realm = route.realm;
        ext.add(event);
    }
fork icon0
star icon0
watch icon6