Comparing version 0.3.0 to 0.4.0
/** | ||
* Cylinder-Head-Sector Address | ||
* @constructor | ||
* @param {Number} cylinder | ||
* @param {Number} head | ||
* @param {Number} sector | ||
* @return {CHS} | ||
* @param {(Number|Buffer)} [cylinder=1023] | ||
* @param {Number} [head=254] | ||
* @param {Number} [sector=63] | ||
*/ | ||
@@ -26,8 +25,11 @@ function CHS( cylinder, head, sector ) { | ||
/** @type {Number} Cylinder */ | ||
this.cylinder = cylinder != null ? | ||
( cylinder | 0 ) : 1023 | ||
/** @type {Number} Head */ | ||
this.head = head != null ? | ||
( head | 0 ) : 254 | ||
/** @type {Number} Sector */ | ||
this.sector = sector != null ? | ||
@@ -61,2 +63,3 @@ ( sector | 0 ) : 63 | ||
* @type {Object} | ||
* @ignore | ||
*/ | ||
@@ -67,6 +70,3 @@ CHS.prototype = { | ||
/** | ||
* Get/set values from/to a Buffer | ||
* @property {Buffer} buffer | ||
*/ | ||
/** @type {Buffer} Get/set values from/to a Buffer */ | ||
set buffer( value ) { return this.parse( value ) }, | ||
@@ -112,2 +112,25 @@ get buffer() { return this.toBuffer() }, | ||
/** | ||
* Clone the CHS Address | ||
* @return {CHS} | ||
*/ | ||
clone: function() { | ||
return new CHS( this.cylinder, this.head, this.sector ) | ||
}, | ||
/** | ||
* Copy this address to a target address | ||
* @param {CHS} target | ||
* @return {CHS} | ||
*/ | ||
copy: function( target ) { | ||
target.cylinder = this.cylinder | ||
target.head = this.head | ||
target.sector = this.sector | ||
return target | ||
}, | ||
/** | ||
* Parse a given Buffer | ||
@@ -114,0 +137,0 @@ * @param {Buffer} buffer |
{ | ||
"name": "chs", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Cylinder-Head-Sector Address (CHS)", | ||
@@ -37,4 +37,5 @@ "author": "Jonas Hermsmeier <jhermsmeier@gmail.com> (https://jhermsmeier.de/)", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha", | ||
"docs": "echo '# API Reference' > API.md; jsdoc2md 'lib/**/*.js' --separators --global-index-format grouped --property-list-format list --param-list-format list >> API.md" | ||
} | ||
} |
147
README.md
@@ -56,3 +56,2 @@ # CHS (Cylinder-Head-Sector) Address | ||
# API Reference | ||
<a name="CHS"></a> | ||
@@ -64,8 +63,13 @@ | ||
* [CHS](#CHS) | ||
* [new CHS(cylinder, head, sector)](#new_CHS_new) | ||
* [new CHS([cylinder], [head], [sector])](#new_CHS_new) | ||
* _instance_ | ||
* [.buffer](#CHS+buffer) | ||
* [.cylinder](#CHS+cylinder) : <code>Number</code> | ||
* [.head](#CHS+head) : <code>Number</code> | ||
* [.sector](#CHS+sector) : <code>Number</code> | ||
* [.buffer](#CHS+buffer) : <code>Buffer</code> | ||
* [.setLBA(lba, hpt, spt)](#CHS+setLBA) ⇒ <code>[CHS](#CHS)</code> | ||
* [.getLBA(hpt, spt)](#CHS+getLBA) ⇒ <code>Number</code> | ||
* [.toLBA(hpt, spt)](#CHS+toLBA) ⇒ <code>Number</code> | ||
* [.clone()](#CHS+clone) ⇒ <code>[CHS](#CHS)</code> | ||
* [.copy(target)](#CHS+copy) ⇒ <code>[CHS](#CHS)</code> | ||
* [.parse(buffer)](#CHS+parse) ⇒ <code>[CHS](#CHS)</code> | ||
@@ -77,25 +81,54 @@ * [.toBuffer()](#CHS+toBuffer) ⇒ <code>Buffer</code> | ||
- | ||
<a name="new_CHS_new"></a> | ||
### new CHS(cylinder, head, sector) | ||
### new CHS([cylinder], [head], [sector]) | ||
Cylinder-Head-Sector Address | ||
**Params** | ||
| Param | Type | | ||
| --- | --- | | ||
| cylinder | <code>Number</code> | | ||
| head | <code>Number</code> | | ||
| sector | <code>Number</code> | | ||
- [cylinder] <code>Number</code> | <code>Buffer</code> <code> = 1023</code> | ||
- [head] <code>Number</code> <code> = 254</code> | ||
- [sector] <code>Number</code> <code> = 63</code> | ||
- | ||
<a name="CHS+cylinder"></a> | ||
### chS.cylinder : <code>Number</code> | ||
Cylinder | ||
**Kind**: instance property of <code>[CHS](#CHS)</code> | ||
- | ||
<a name="CHS+head"></a> | ||
### chS.head : <code>Number</code> | ||
Head | ||
**Kind**: instance property of <code>[CHS](#CHS)</code> | ||
- | ||
<a name="CHS+sector"></a> | ||
### chS.sector : <code>Number</code> | ||
Sector | ||
**Kind**: instance property of <code>[CHS](#CHS)</code> | ||
- | ||
<a name="CHS+buffer"></a> | ||
### chS.buffer | ||
### chS.buffer : <code>Buffer</code> | ||
Get/set values from/to a Buffer | ||
**Kind**: instance property of <code>[CHS](#CHS)</code> | ||
**Properties** | ||
| Name | Type | | ||
| --- | --- | | ||
| buffer | <code>Buffer</code> | | ||
- | ||
@@ -108,9 +141,11 @@ <a name="CHS+setLBA"></a> | ||
**Kind**: instance method of <code>[CHS](#CHS)</code> | ||
**Params** | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| lba | <code>Number</code> | Logical Block Address | | ||
| hpt | <code>Number</code> | Heads per Track | | ||
| spt | <code>Number</code> | Sectors per Track | | ||
- lba <code>Number</code> - Logical Block Address | ||
- hpt <code>Number</code> - Heads per Track | ||
- spt <code>Number</code> - Sectors per Track | ||
- | ||
<a name="CHS+getLBA"></a> | ||
@@ -124,8 +159,10 @@ | ||
**Returns**: <code>Number</code> - lba | ||
**Params** | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| hpt | <code>Number</code> | Heads per Track | | ||
| spt | <code>Number</code> | Sectors per Track | | ||
- hpt <code>Number</code> - Heads per Track | ||
- spt <code>Number</code> - Sectors per Track | ||
- | ||
<a name="CHS+toLBA"></a> | ||
@@ -137,8 +174,32 @@ | ||
**See**: #getLBA() | ||
**Params** | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| hpt | <code>Number</code> | Heads per Track | | ||
| spt | <code>Number</code> | Sectors per Track | | ||
- hpt <code>Number</code> - Heads per Track | ||
- spt <code>Number</code> - Sectors per Track | ||
- | ||
<a name="CHS+clone"></a> | ||
### chS.clone() ⇒ <code>[CHS](#CHS)</code> | ||
Clone the CHS Address | ||
**Kind**: instance method of <code>[CHS](#CHS)</code> | ||
- | ||
<a name="CHS+copy"></a> | ||
### chS.copy(target) ⇒ <code>[CHS](#CHS)</code> | ||
Copy this address to a target address | ||
**Kind**: instance method of <code>[CHS](#CHS)</code> | ||
**Params** | ||
- target <code>[CHS](#CHS)</code> | ||
- | ||
<a name="CHS+parse"></a> | ||
@@ -150,7 +211,9 @@ | ||
**Kind**: instance method of <code>[CHS](#CHS)</code> | ||
**Params** | ||
| Param | Type | | ||
| --- | --- | | ||
| buffer | <code>Buffer</code> | | ||
- buffer <code>Buffer</code> | ||
- | ||
<a name="CHS+toBuffer"></a> | ||
@@ -162,2 +225,5 @@ | ||
**Kind**: instance method of <code>[CHS](#CHS)</code> | ||
- | ||
<a name="CHS.fromBuffer"></a> | ||
@@ -169,7 +235,9 @@ | ||
**Kind**: static method of <code>[CHS](#CHS)</code> | ||
**Params** | ||
| Param | Type | | ||
| --- | --- | | ||
| buffer | <code>Buffer</code> | | ||
- buffer <code>Buffer</code> | ||
- | ||
<a name="CHS.fromLBA"></a> | ||
@@ -181,7 +249,10 @@ | ||
**Kind**: static method of <code>[CHS](#CHS)</code> | ||
**Params** | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| lba | <code>Number</code> | Logical Block Address | | ||
| hpt | <code>Number</code> | Heads per Track | | ||
| spt | <code>Number</code> | Sectors per Track | | ||
- lba <code>Number</code> - Logical Block Address | ||
- hpt <code>Number</code> - Heads per Track | ||
- spt <code>Number</code> - Sectors per Track | ||
- | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11609
138
249