time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (1892B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 /**
     22 * Map keys from one object to a new object having the same values.
     23 *
     24 * @module @stdlib/utils/async/map-keys
     25 *
     26 * @example
     27 * var readFile = require( '@stdlib/fs/read-file' );
     28 * var mapKeysAsync = require( '@stdlib/utils/async/map-keys' );
     29 *
     30 * function read( key, value, next ) {
     31 *     var opts = {
     32 *         'encoding': 'utf8'
     33 *     };
     34 *     readFile( value, opts, onFile );
     35 *
     36 *     function onFile( error ) {
     37 *         if ( error ) {
     38 *             return next( null, key+':unreadable' );
     39 *         }
     40 *         next( null, key+':readable' );
     41 *     }
     42 * }
     43 *
     44 * // Define a callback which handles errors:
     45 * function done( error, out ) {
     46 *     if ( error ) {
     47 *         throw error;
     48 *     }
     49 *     console.log( out );
     50 * }
     51 *
     52 * // Create a dictionary of file names:
     53 * var files = {
     54 *     'file1': './beep.js',
     55 *     'file2': './boop.js'
     56 * };
     57 *
     58 * var opts = {
     59 *     'series': true
     60 * };
     61 *
     62 * // Process each file in `files`:
     63 * mapKeysAsync( files, opts, read, done );
     64 */
     65 
     66 // MODULES //
     67 
     68 var setReadOnly = require( './../../../define-nonenumerable-read-only-property' );
     69 var mapKeysAsync = require( './map_keys.js' );
     70 var factory = require( './factory.js' );
     71 
     72 
     73 // MAIN //
     74 
     75 setReadOnly( mapKeysAsync, 'factory', factory );
     76 
     77 
     78 // EXPORTS //
     79 
     80 module.exports = mapKeysAsync;