How to use the reach function from hoek
Find comprehensive JavaScript hoek.reach code examples handpicked from public code repositorys.
33 34 35 36 37 38 39 40 41 42for (const [path, operations] of Object.entries(api.paths)) { const pathnames = Utils.unsuffix(path, '/').split('/').slice(1).join('.'); for (const [method, operation] of Object.entries(operations)) { const pathsearch = `${pathnames}.${method}`; const handler = Hoek.reach(handlers, pathsearch); const xoptions = operation['x-hapi-options'] || {}; if (!handler) { continue;
GitHub: vudash/vudash

44 45 46 47 48 49 50 51 52const update = Object.assign({ history }, data) this.emitter.emit(eventId, update, historical) } loadDatasources () { const datasources = reach(this, 'descriptor.datasources', { default: {} }) const hasDatasources = Object.keys(datasources).length this.datasources = hasDatasources ? datasourceLoader.load(datasources) : {} }
+ 7 other calls in file
GitHub: devinivy/dogwater

186 187 188 189 190 191 192 193 194 195if (all) { return waterline.collections; } const collections = {}; const models = Hoek.reach(this, `${realmPath}.plugins.dogwater.models`) || []; for (let i = 0; i < models.length; ++i) { collections[models[i]] = waterline.collections[models[i]]; }
6 7 8 9 10 11 12 13 14 15return request.connection || request.server } utils.getRoutesModifiers = function (plugin) { // plugin.config fallback for hapi < 8 return plugin.config || Hoek.reach(plugin, 'realm.modifiers') } utils.firstCharToUpperCase = function (string) { if (!string || string.length === 0) {
+ 3 other calls in file
204 205 206 207 208 209 210 211 212 213utils.getMetaSwaggerType = function (schema) { return utils.getMeta(schema, 'swaggerType') } utils.isSupportedSchema = function (schema) { return schema != null && Hoek.reach(schema, '_flags.func') !== true && schema.isJoi === true && (utils.isSupportedType(utils.getPrimitiveType(schema)) || utils.getMetaSwaggerType(schema) != null) } utils.isSupportedType = function (type) { return type != null && _.includes(supportedTypes, type)
+ 5 other calls in file
175 176 177 178 179 180 181 182 183 184} var routesPluginOptions = routeSettings.plugins['hapi-swaggered'] || {} Joi.assert(routesPluginOptions, schema.RoutesPluginOptions) var defaultResponseSchema = Hoek.reach(routeSettings, 'response.schema') var statusResponseSchema = Hoek.reach(routeSettings, 'response.status') // Process response var responses = internals.prepareResponses(definitions, routesPluginOptions, defaultResponseSchema, statusResponseSchema) operation.responses = responses
+ 5 other calls in file
GitHub: WesTyler/felicity

36 37 38 39 40 41 42 43 44const generate = function (schemaInput, options) { const self = this; let input = Hoek.reach(options, 'input'); const config = Hoek.reach(options, 'config'); const ignoreDefaults = Hoek.reach(config, 'ignoreDefaults'); const schemaMapper = function (target, schema) {
+ 17 other calls in file
24 25 26 27 28 29 30 31 32 33if (typeof mode !== 'object') { return mode; } return Hoek.reach(mode, method, internals.defaultMode); }; /**
43 44 45 46 47 48 49 50 51 52}, { path: `${inputSegment}/unsafe${sinkSegment}`, method: methods, handler: (request, reply) => { const value = Hoek.reach(request, dataPath); /* For synchronous sink methods: */ if (handle.length == 1) { try {
626 627 628 629 630 631 632 633 634 635_fillOrderedErrors(errors, ordereds, state, options) { const requiredOrdereds = []; for (let i = 0; i < ordereds.length; ++i) { const presence = Hoek.reach(ordereds[i], '_flags.presence'); if (presence === 'required') { requiredOrdereds.push(ordereds[i]); } }
15 16 17 18 19 20 21 22 23 24const settings = Hoek.clone(options); // options can be reused and modified const ref = function (value, validationOptions) { return Hoek.reach(ref.isContext ? validationOptions.context : value, ref.key, settings); }; ref.isContext = (key[0] === ((settings && settings.contextPrefix) || '$')); ref.key = (ref.isContext ? key.slice(1) : key);
115 116 117 118 119 120 121 122 123 124format = (Hoek.reach(localized, 'key') || Hoek.reach(Language.errors, 'key')) + format; } return format.replace(/\{\{(\!?)([^}]+)\}\}/g, ($0, isSecure, name) => { const value = Hoek.reach(this.context, name); const normalized = internals.stringify(value, wrapArrays); return (isSecure ? Hoek.escapeHtml(normalized) : normalized); }); }
+ 3 other calls in file
110 111 112 113 114 115 116 117 118 119if (skipKey) { format = format.slice(2); } if (!hasKey && !skipKey) { const localizedKey = Hoek.reach(localized, 'key'); if (typeof localizedKey === 'string') { format = localizedKey + format; } else {
+ 4 other calls in file
hoek.assert is the most popular function in hoek (1712 examples)





