connect( ( state, { taxonomies } ) => { const features = get( taxonomies, 'theme_feature', [] ).map( ( { name, slug } ) => { const term = isValidThemeFilterTerm( state, slug ) ? slug : `feature:${ slug }`; return { name, slug, term }; } ); return { features }; } )( localize( ThemeFeaturesCard ) )
function getDisplayItemsForLineItems( items ) { return items.map( ( { label, amount } ) => ( { label, amount: amount.value, } ) ); }
export default function dehumanizeTime(input) { if (typeof input !== 'string') { return NaN; } const parts = input.replace(/ /g, '').match(ALPHA_NUMERIC_DOT); const sets = parts.map(part => part.split(ALPHA_NUMERIC_DOT).filter(o => o)); return sets.reduce((accum, [number, unit]) => { return accum + parseFloat(number) * TIMES[unit]; }, 0); }
_orderedHandlers() { return [...this.middleware, this].reduce((handlers, route) => { handlers.push(...route.handlers.map(handler => ({ route, handler }))); return handlers; }, []); }
map(objectKeys(obj), function(k) { var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; if (isArray(obj[k])) { return map(obj[k], function(v) { return ks + encodeURIComponent(stringifyPrimitive(v)); }).join(sep); } else { return ks + encodeURIComponent(stringifyPrimitive(obj[k])); } }).join(sep)
function validateAndCast(value) { if (typeof value === 'string') return value; if (typeof value === 'number') return value.toString(); if (typeof value[0] === 'string') return value; if (typeof value[0] === 'number') { return value.map((value) => value.toString()); } throw new Error( 'unrecognized value, expected string[], string, number[], or number' ); }
// 'a' /** * Turn the # into 1s and . into 0s. for whole string * @param string * @returns {Array} */ function character(string: string): number[] { return string.trim().split('').map(integer); }
Object.keys(options.cookie) .map( (key) => encodeURIComponent(key) + '=' + encodeURIComponent(options.cookie[key]), ) .join('; ')
config() { return mergeConfigs( ...this[HANDLERS].map(({ handler }) => handler.get('config')) ); }
/** * Reads a list of files and joins their contents together with newlines * * @param {Array<string>} inputFiles Paths of the files to parse * @returns {string} Concatenated file contents */ function concatAllFiles( inputFiles ) { return inputFiles.map( ( inputFile ) => fs.readFileSync( inputFile, 'utf8' ) ).join( '\n' ); }