README.md (2989B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2020 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 # isComposite 22 23 > Test if a value is a composite number. 24 25 <section class="intro"> 26 27 A **composite number** is defined as a positive integer value greater than `1` which has **at least** one divisor other than `1` and itself (i.e., an integer value which can be formed by multiplying two smaller positive integers). 28 29 </section> 30 31 <!-- /.intro --> 32 33 <section class="usage"> 34 35 ## Usage 36 37 ```javascript 38 var isComposite = require( '@stdlib/assert/is-composite' ); 39 ``` 40 41 #### isComposite( value ) 42 43 Tests if a `value` is a composite number. 44 45 <!-- eslint-disable no-new-wrappers --> 46 47 ```javascript 48 var Number = require( '@stdlib/number/ctor' ); 49 50 var bool = isComposite( 4.0 ); 51 // returns true 52 53 bool = isComposite( new Number( 4.0 ) ); 54 // returns true 55 56 bool = isComposite( 3.14 ); 57 // returns false 58 59 bool = isComposite( -4.0 ); 60 // returns false 61 62 bool = isComposite( NaN ); 63 // returns false 64 65 bool = isComposite( null ); 66 // returns false 67 ``` 68 69 #### isComposite.isPrimitive( value ) 70 71 Tests if a `value` is a primitive composite number. 72 73 <!-- eslint-disable no-new-wrappers --> 74 75 ```javascript 76 var Number = require( '@stdlib/number/ctor' ); 77 78 var bool = isComposite.isPrimitive( 4.0 ); 79 // returns true 80 81 bool = isComposite.isPrimitive( new Number( 4.0 ) ); 82 // returns false 83 ``` 84 85 #### isComposite.isObject( value ) 86 87 Tests if a `value` is a `Number` object having a value which is a composite number. 88 89 <!-- eslint-disable no-new-wrappers --> 90 91 ```javascript 92 var Number = require( '@stdlib/number/ctor' ); 93 94 var bool = isComposite.isObject( 4.0 ); 95 // returns false 96 97 bool = isComposite.isObject( new Number( 4.0 ) ); 98 // returns true 99 ``` 100 101 </section> 102 103 <!-- /.usage --> 104 105 <section class="examples"> 106 107 ## Examples 108 109 <!-- eslint-disable no-new-wrappers --> 110 111 <!-- eslint no-undef: "error" --> 112 113 ```javascript 114 var Number = require( '@stdlib/number/ctor' ); 115 var isComposite = require( '@stdlib/assert/is-composite' ); 116 117 var bool = isComposite( 4.0 ); 118 // returns true 119 120 bool = isComposite( new Number( 4.0 ) ); 121 // returns true 122 123 bool = isComposite( 10.0 ); 124 // returns true 125 126 bool = isComposite( 7.0 ); 127 // returns false 128 129 bool = isComposite( 3.14 ); 130 // returns false 131 132 bool = isComposite( -4.0 ); 133 // returns false 134 135 bool = isComposite( NaN ); 136 // returns false 137 138 bool = isComposite( '0.5' ); 139 // returns false 140 141 bool = isComposite( null ); 142 // returns false 143 ``` 144 145 </section> 146 147 <!-- /.examples --> 148 149 <section class="links"> 150 151 </section> 152 153 <!-- /.links -->