README.md (2540B)
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 # Number 22 23 > [Constructor][mdn-number] which wraps a numeric value in an object. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 </section> 30 31 <!-- /.intro --> 32 33 <!-- Package usage documentation. --> 34 35 <section class="usage"> 36 37 ## Usage 38 39 ```javascript 40 var Number = require( '@stdlib/number/ctor' ); 41 ``` 42 43 #### Number( value ) 44 45 Returns a [`Number`][mdn-number] object. 46 47 <!-- eslint-disable stdlib/require-globals, no-new-wrappers --> 48 49 ```javascript 50 var v = new Number( 5.0 ); 51 // returns <Number> 52 ``` 53 54 </section> 55 56 <!-- /.usage --> 57 58 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 59 60 <section class="notes"> 61 62 ## Notes 63 64 - This constructor should be used sparingly. **Always** prefer number primitives. 65 66 </section> 67 68 <!-- /.notes --> 69 70 <!-- Package usage examples. --> 71 72 <section class="examples"> 73 74 ## Examples 75 76 <!-- eslint-disable no-new-wrappers --> 77 78 <!-- eslint no-undef: "error" --> 79 80 ```javascript 81 var randu = require( '@stdlib/random/base/randu' ); 82 var Number = require( '@stdlib/number/ctor' ); 83 84 var v; 85 var i; 86 87 for ( i = 0; i < 100; i++ ) { 88 v = new Number( randu() ); 89 console.log( 'typeof %d: %s', v, typeof v ); 90 } 91 ``` 92 93 </section> 94 95 <!-- /.examples --> 96 97 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 98 99 <section class="references"> 100 101 </section> 102 103 <!-- /.references --> 104 105 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 106 107 <section class="links"> 108 109 [mdn-number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number 110 111 </section> 112 113 <!-- /.links -->