{"_id":"dstructs-array-dtype","_rev":"3-8a28f4b4e12239075989926248f08170","name":"dstructs-array-dtype","description":"Returns an array data type corresponding to an array constructor name.","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.2":{"name":"dstructs-array-dtype","version":"1.0.2","description":"Returns an array data type corresponding to an array constructor name.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","codecov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/codecov/coverage --report lcovonly -- -R spec && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov"},"main":"./lib","repository":{"type":"git","url":"git://github.com/dstructs/array-dtype.git"},"keywords":["compute.io","compute","computation","dstructs","constructor","typed-array","typed","array","ctor","dtype","data","type","util","utils","utility","utilities"],"bugs":{"url":"https://github.com/dstructs/array-dtype/issues"},"dependencies":{},"devDependencies":{"chai":"3.x.x","mocha":"2.x.x","codecov.io":"^0.1.5","istanbul":"^0.3.0","jshint":"2.x.x","jshint-stylish":"2.x.x"},"license":"MIT","gitHead":"97b863f6d112bf0b806b64c17920cf8ad4df6d39","homepage":"https://github.com/dstructs/array-dtype#readme","_id":"dstructs-array-dtype@1.0.2","_shasum":"c368fb6e46229dfa2409f700cc43a209b480e76e","_from":".","_npmVersion":"2.8.3","_nodeVersion":"0.12.7","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"dist":{"shasum":"c368fb6e46229dfa2409f700cc43a209b480e76e","tarball":"https://registry.npmjs.org/dstructs-array-dtype/-/dstructs-array-dtype-1.0.2.tgz","integrity":"sha512-QR/7uPQoENYye8adi4OSLI72PnaPm4Pj2gpVPULV9DjsvxCqQAHsAtJg3PvycSLcLk0kTITnZD31ZFaNYxkjhA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCSfwCSipkanEke19X8FrJysbHNTCqhDqVWmtvCawKhjQIhALGzjTrXZrR9+2cm/hVshyJmnR82w44Lnv01c1EcKuMA"}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}]}},"readme":"array-dtype\n===\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependencies][dependencies-image]][dependencies-url]\n\n> Returns an array data type corresponding to an array constructor name.\n\n\n## Installation\n\n``` bash\n$ npm install dstructs-array-dtype\n```\n\nFor use in the browser, use [browserify](https://github.com/substack/node-browserify).\n\n\n## Usage\n\n``` javascript\nvar getType = require( 'dstructs-array-dtype' );\n```\n\n#### getType( name )\n\nReturns an `array` data type corresponding to an `array` constructor name.\n\n``` javascript\nvar dtype = getType( 'Float32Array' );\n// returns 'float32'\n\nvar arr = new Float32Array( 10 );\n\ndtype = getType( Object.prototype.toString.call( arr ).slice(8,-1) );\n// returns 'float32'\n\n// Note: not supported in IE\ndtype = getType( arr.constructor.name );\n// returns 'float32'\n```\n\nThe following `array` constructors are supported:\n\n| Constructor | Data Type |\n|:----------|:------------|\n| [`Int8Array`][Int8Array] | int8 | \n| [`Uint8Array`][Uint8Array] | uint8 | \n| [`Uint8ClampedArray`][Uint8ClampedArray] | uint8_clamped |\n| [`Int16Array`][Int16Array] | int16 |\n| [`Uint16Array`][Uint16Array] | uint16 |\n| [`Int32Array`][Int32Array] | int32 |\n| [`Uint32Array`][Uint32Array] | uint32 |\n| [`Float32Array`][Float32Array] | float32 |\n| [`Float64Array`][Float64Array] | float64 |\n| [`Array`][Array] | generic |\n\n\n## Examples\n\n``` javascript\nvar getType = require( 'dstructs-array-dtype' );\n\nconsole.log( getType( 'Int8Array' ) );\n// returns 'int8'\n\nconsole.log( getType( 'Uint8Array' ) );\n// returns 'uint8'\n\nconsole.log( getType( 'Uint8ClampedArray' ) );\n// returns 'uint8_clamped'\n\nconsole.log( getType( 'Int16Array' ) );\n// returns 'int16'\n\nconsole.log( getType( 'Uint16Array' ) );\n// returns 'uint16'\n\nconsole.log( getType( 'Int32Array' ) );\n// returns 'int32'\n\nconsole.log( getType( 'Uint32Array' ) );\n// returns 'uint32'\n\nconsole.log( getType( 'Float32Array' ) );\n// returns 'float32'\n\nconsole.log( getType( 'Float64Array' ) );\n// returns 'float64'\n\nconsole.log( getType( 'Array' ) );\n// returns 'generic'\n\nconsole.log( getType( 'Object' ) );\n// returns null\n\nconsole.log( getType( 'String' ) );\n// returns null\n\nconsole.log( getType( 'Boolean' ) );\n// returns null\n\nconsole.log( getType( 'Number' ) );\n// returns null\n\nconsole.log( getType( 'null' ) );\n// returns null\n\nconsole.log( getType( [] ) );\n// returns null\n\nconsole.log( getType( null ) );\n// returns null\n\nconsole.log( getType( {} ) );\n// returns null\n```\n\nTo run the example code from the top-level application directory,\n\n``` bash\n$ node ./examples/index.js\n```\n\n\n## Tests\n\n### Unit\n\nUnit tests use the [Mocha][mocha] test framework with [Chai][chai] assertions. To run the tests, execute the following command in the top-level application directory:\n\n``` bash\n$ make test\n```\n\nAll new feature development should have corresponding unit tests to validate correct functionality.\n\n\n### Test Coverage\n\nThis repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-cov\n```\n\nIstanbul creates a `./reports/coverage` directory. To access an HTML version of the report,\n\n``` bash\n$ make view-cov\n```\n\n\n---\n## License\n\n[MIT license](http://opensource.org/licenses/MIT).\n\n\n## Copyright\n\nCopyright &copy; 2015. The Compute.io Authors.\n\n\n[npm-image]: http://img.shields.io/npm/v/dstructs-array-dtype.svg\n[npm-url]: https://npmjs.org/package/dstructs-array-dtype\n\n[travis-image]: http://img.shields.io/travis/dstructs/array-dtype/master.svg\n[travis-url]: https://travis-ci.org/dstructs/array-dtype\n\n[codecov-image]: https://img.shields.io/codecov/c/github/dstructs/array-dtype/master.svg\n[codecov-url]: https://codecov.io/github/dstructs/array-dtype?branch=master\n\n[dependencies-image]: http://img.shields.io/david/dstructs/array-dtype.svg\n[dependencies-url]: https://david-dm.org/dstructs/array-dtype\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/dstructs/array-dtype.svg\n[dev-dependencies-url]: https://david-dm.org/dev/dstructs/array-dtype\n\n[github-issues-image]: http://img.shields.io/github/issues/dstructs/array-dtype.svg\n[github-issues-url]: https://github.com/dstructs/array-dtype/issues\n\n[mocha]: http://mochajs.org/\n[chai]: http://chaijs.com\n[istanbul]: https://github.com/gotwarlost/istanbul\n\n[Int8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array\n[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array\n[Uint8ClampedArray]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray\n[Int16Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array\n[Uint16Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array\n[Int32Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array\n[Uint32Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array\n[Float32Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array\n[Float64Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array\n[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array\n","maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"time":{"modified":"2022-06-16T01:03:26.792Z","created":"2015-11-27T23:21:55.578Z","1.0.2":"2015-11-27T23:21:55.578Z"},"homepage":"https://github.com/dstructs/array-dtype#readme","keywords":["compute.io","compute","computation","dstructs","constructor","typed-array","typed","array","ctor","dtype","data","type","util","utils","utility","utilities"],"repository":{"type":"git","url":"git://github.com/dstructs/array-dtype.git"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"bugs":{"url":"https://github.com/dstructs/array-dtype/issues"},"license":"MIT","readmeFilename":"README.md"}