nl_tokens: These standardize * functions show what will happen to the output of your page methods . For middleware authors : Be aware that these standardization functions will have been applied to the output of next () before you get access to it . These functions are also exposed via PageUtil . standardize * . This method takes in anything returned from a Page . getElements call and returns the elements in a standardized format : an array of EarlyPromises of ReactElements .
pl_tokens: function standardizeElements ( elements ) { // The return value could be a single element or an array. // First, let's make sure that it's an array. // Then, ensure that all elements are wrapped in promises. return makeArray ( elements ) . map ( e => isRootContainer ( e ) ? flattenForRender ( e ) : e ) . reduce ( ( m , e ) => m . concat ( <mask> . isArray ( e ) ? e : [ e ] ) , [ ] ) . map ( e => isTheFold ( e ) ? markTheFold ( ) : e ) . map ( ensureRootElement ) . map ( scheduleRender ) }