README.md (1989B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # isGeneratorObjectLike 22 23 > Test if a value is [`generator`][mdn-generator-object] object-like. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isGeneratorObjectLike = require( '@stdlib/assert/is-generator-object-like' ); 31 ``` 32 33 #### isGeneratorObjectLike( value ) 34 35 Tests if a `value` is [`generator`][mdn-generator-object] object-like. 36 37 <!-- eslint-disable no-restricted-syntax, no-empty-function --> 38 39 ```javascript 40 var obj = { 41 'next': function noop() {}, 42 'return': function noop() {}, 43 'throw': function noop() {} 44 }; 45 var bool = isGeneratorObjectLike( obj ); 46 // returns true 47 48 bool = isGeneratorObjectLike( {} ); 49 // returns false 50 ``` 51 52 </section> 53 54 <!-- /.usage --> 55 56 <section class="examples"> 57 58 ## Examples 59 60 <!-- eslint no-undef: "error" --> 61 62 ```javascript 63 var noop = require( '@stdlib/utils/noop' ); 64 var isGeneratorObjectLike = require( '@stdlib/assert/is-generator-object-like' ); 65 66 var obj = { 67 'next': noop, 68 'return': noop, 69 'throw': noop 70 }; 71 var bool = isGeneratorObjectLike( obj ); 72 // returns true 73 74 bool = isGeneratorObjectLike( {} ); 75 // returns false 76 77 bool = isGeneratorObjectLike( [] ); 78 // returns false 79 80 bool = isGeneratorObjectLike( null ); 81 // returns false 82 ``` 83 84 </section> 85 86 <!-- /.examples --> 87 88 <section class="links"> 89 90 [mdn-generator-object]: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Generator 91 92 </section> 93 94 <!-- /.links -->