How to use the flatten function from hoek
Find comprehensive JavaScript hoek.flatten code examples handpicked from public code repositorys.
GitHub: dolfly/arangodb
51 52 53 54 55 56 57 58 59
internals.Alternatives.prototype.try = function (/* schemas */) { var schemas = Hoek.flatten(Array.prototype.slice.call(arguments)); Hoek.assert(schemas.length, 'Cannot add other alternatives without at least one schema'); var obj = this.clone();
813
0
2
+ 3 other calls in file
GitHub: bloglovin/hoek
166 167 168 169 170 171 172 173 174
```javascript var array = [1, 2, 3]; var target = [4, 5]; var flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3]; ``` ### reach(obj, chain, [options])
170
1
33
219 220 221 222 223 224 225 226 227
```javascript var array = [1, [2, 3]]; var flattenedArray = Hoek.flatten(array); // results in [1, 2, 3] array = [1, [2, 3]]; target = [4, [5]];
170
0
14
+ 3 other calls in file
GitHub: rook2pawn/podium
80 81 82 83 84 85 86 87 88 89
}; internals.Podium.prototype.registerEvent = function (events, options = {}) { events = Hoek.flatten([].concat(events)); events.forEach((event) => { if (!event) { return;
25
0
2
329 330 331 332 333 334 335 336 337 338
items() { const obj = this.clone(); Hoek.flatten(Array.prototype.slice.call(arguments)).forEach((type, index) => { try { type = Cast.schema(this._currentJoi, type); }
0
1
0
242 243 244 245 246 247 248 249 250
return joi; }; root.extend = function () { const extensions = Hoek.flatten(Array.prototype.slice.call(arguments)); Hoek.assert(extensions.length > 0, 'You need to provide at least one extension'); this.assert(extensions, root.extensionsSchema);
0
1
0
66 67 68 69 70 71 72 73 74
return { errors: this.createError('alternatives.base', null, state, options) }; } try(/* schemas */) { const schemas = Hoek.flatten(Array.prototype.slice.call(arguments)); Hoek.assert(schemas.length, 'Cannot add other alternatives without at least one schema'); const obj = this.clone();
0
0
1
247 248 249 250 251 252 253 254 255
return joi; }; root.extend = function (...args) { const extensions = Hoek.flatten(args); Hoek.assert(extensions.length > 0, 'You need to provide at least one extension'); this.assert(extensions, root.extensionsSchema);
0
0
0
333 334 335 336 337 338 339 340 341 342
items(...schemas) { const obj = this.clone(); Hoek.flatten(schemas).forEach((type, index) => { try { type = Cast.schema(this._currentJoi, type); }
0
0
0
GitHub: yaowang908/hapi
111 112 113 114 115 116 117 118 119
let labels = []; for (let i = 0; i < arguments.length; ++i) { labels.push(arguments[i]); } labels = Hoek.flatten(labels); return this._select(labels); };
0
0
1
hoek.assert is the most popular function in hoek (1712 examples)