main.js (1531B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2020 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 // MODULES // 22 23 var iterMap = require( './../../../../iter/tools/map' ); 24 var tan = require( './../../../../base/special/tan' ); 25 26 27 // MAIN // 28 29 /** 30 * Returns an iterator which iteratively evaluates the tangent. 31 * 32 * ## Notes 33 * 34 * - If an environment supports `Symbol.iterator` **and** a provided iterator is iterable, the returned iterator is iterable. 35 * 36 * @param {Iterator} iterator - input iterator 37 * @throws {TypeError} must provide an iterator protocol-compliant object 38 * @returns {Iterator} iterator 39 * 40 * @example 41 * var uniform = require( '@stdlib/random/iter/uniform' ); 42 * 43 * var iter = iterTan( uniform( -1.57, 1.57 ) ); 44 * 45 * var v = iter.next().value; 46 * // returns <number> 47 * 48 * v = iter.next().value; 49 * // returns <number> 50 * 51 * v = iter.next().value; 52 * // returns <number> 53 * 54 * // ... 55 */ 56 function iterTan( iterator ) { 57 return iterMap( iterator, tan ); 58 } 59 60 61 // EXPORTS // 62 63 module.exports = iterTan;