time-to-botec

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

README.md (2306B)


      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 # isBoxedPrimitive
     22 
     23 > Test if a value is a JavaScript boxed primitive.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isBoxedPrimitive = require( '@stdlib/assert/is-boxed-primitive' );
     31 ```
     32 
     33 #### isBoxedPrimitive( value )
     34 
     35 Tests if a `value` is a JavaScript boxed primitive.
     36 
     37 <!-- eslint-disable no-new-wrappers-->
     38 
     39 ```javascript
     40 var bool = isBoxedPrimitive( new Boolean( false ) );
     41 // returns true
     42 
     43 bool = isBoxedPrimitive( true );
     44 // returns false
     45 ```
     46 
     47 </section>
     48 
     49 <!-- /.usage -->
     50 
     51 <section class="notes">
     52 
     53 ## Notes
     54 
     55 -   Boxed primitive objects can be created with one of the following:
     56 
     57     -   `new Boolean()`
     58     -   `new Number()`
     59     -   `new String()`
     60     -   `Object( Symbol() )` (ES6/ES2015)
     61 
     62 </section>
     63 
     64 <!-- /.notes -->
     65 
     66 <section class="examples">
     67 
     68 ## Examples
     69 
     70 <!-- eslint-disable no-restricted-syntax, no-new-object, no-new-wrappers, no-empty-function, no-array-constructor -->
     71 
     72 <!-- eslint no-undef: "error" -->
     73 
     74 ```javascript
     75 var Number = require( '@stdlib/number/ctor' );
     76 var isBoxedPrimitive = require( '@stdlib/assert/is-boxed-primitive' );
     77 
     78 var bool = isBoxedPrimitive( new Boolean( false ) );
     79 // returns true
     80 
     81 bool = isBoxedPrimitive( new String( 'beep' ) );
     82 // returns true
     83 
     84 bool = isBoxedPrimitive( new Number( 3.14 ) );
     85 // returns true
     86 
     87 bool = isBoxedPrimitive( false );
     88 // returns false
     89 
     90 bool = isBoxedPrimitive( 0 );
     91 // returns false
     92 
     93 bool = isBoxedPrimitive( '' );
     94 // returns false
     95 
     96 bool = isBoxedPrimitive( null );
     97 // returns false
     98 
     99 bool = isBoxedPrimitive( void 0 );
    100 // returns false
    101 
    102 bool = isBoxedPrimitive( [] );
    103 // returns false
    104 
    105 bool = isBoxedPrimitive( {} );
    106 // returns false
    107 ```
    108 
    109 </section>
    110 
    111 <!-- /.examples -->
    112 
    113 <section class="links">
    114 
    115 </section>
    116 
    117 <!-- /.links -->