time-to-botec

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

README.md (1955B)


      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 # isCircularPlainObject
     22 
     23 > Test if a value is a plain object containing a circular reference.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isCircularPlainObject = require( '@stdlib/assert/is-circular' );
     31 ```
     32 
     33 #### isCircularPlainObject( value )
     34 
     35 Tests if a `value` is a plain `object` containing a circular reference.
     36 
     37 ```javascript
     38 var obj = {
     39     'beep': 'boop'
     40 };
     41 var bool = isCircularPlainObject( obj );
     42 // returns false
     43 
     44 obj.self = obj;
     45 bool = isCircularPlainObject( obj );
     46 // returns true
     47 ```
     48 
     49 </section>
     50 
     51 <!-- /.usage -->
     52 
     53 <section class="examples">
     54 
     55 ## Examples
     56 
     57 <!-- eslint no-undef: "error" -->
     58 
     59 ```javascript
     60 var isCircularPlainObject = require( '@stdlib/assert/is-circular' );
     61 
     62 var obj1 = {
     63     'a': 'beep',
     64     'b': {
     65         'c': 'boop'
     66     }
     67 };
     68 obj1.b.self = obj1;
     69 var bool = isCircularPlainObject( obj1 );
     70 // returns true
     71 
     72 var obj2 = {
     73     'a': {},
     74     'b': obj1
     75 };
     76 bool = isCircularPlainObject( obj2 );
     77 // returns true
     78 
     79 var arr = [ 1, 2, 3 ];
     80 arr.push( arr );
     81 bool = isCircularPlainObject( arr );
     82 // returns false
     83 
     84 var obj3 = {
     85     'beep': 'boop'
     86 };
     87 bool = isCircularPlainObject({
     88     'a': obj3,
     89     'b': obj3
     90 });
     91 // returns false
     92 
     93 bool = isCircularPlainObject( {} );
     94 // returns false
     95 
     96 bool = isCircularPlainObject( null );
     97 // returns false
     98 ```
     99 
    100 </section>
    101 
    102 <!-- /.examples -->
    103 
    104 <section class="links">
    105 
    106 </section>
    107 
    108 <!-- /.links -->