Skip to content

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
royaltm committed Jun 5, 2016
1 parent 6c07da1 commit 8d3a3ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,43 +102,43 @@ murmurHash(data, encoding, output_type[, callback])
murmurHash(data{String}, encoding, output[, offset[, length]][, callback])
murmurHash(data{String}, encoding, seed[, output[, offset[, length]]][, callback])
murmurHash(data{String}, encoding, seed[, output_type][, callback])
```

@param {string|Buffer} data - a byte-string to calculate hash from
@param {string} encoding - data string encoding, should be:
'utf8', 'ucs2', 'ascii', 'hex', 'base64' or 'binary';
'binary' by default
@param {Uint32} seed - murmur hash seed, 0 by default
@param {Buffer} output - a Buffer object to write hash bytes to;
the same object will be returned
@param {number} offset - start writing into output at offset byte;
negative offset starts from the end of the output buffer
@param {number} length - a number of bytes to write from calculated hash;
negative length starts from the end of the hash;
if absolute value of length is larger than the size of a calculated
hash, bytes are written only up to the hash size
@param {string} output_type - a string indicating return type:
'number' - for murmurHash32 an unsigned 32-bit integer,
other hashes - hexadecimal string
'hex' - hexadecimal string
'base64' - base64 string
'binary' - binary string
'buffer' - a new Buffer object;
'number' by default
@param {Function} callback - optional callback(err, result)
if provided the hash will be calculated asynchronously using libuv
worker queue, the return value in this instance will be `undefined`
and the result will be provided to the callback function;
Be carefull as reading and writing by multiple threads to the same
memory may render undetermined results
* `@param` `{string|Buffer}` `data` - a byte-string to calculate hash from
* `@param` `{string}` `encoding` - data string encoding, should be:
"utf8", "ucs2", "ascii", "hex", "base64" or "binary";
"binary" by default
* `@param` `{Uint32}` `seed` - murmur hash seed, 0 by default
* `@param` `{Buffer}` `output` - a Buffer object to write hash bytes to;
the same object will be returned
* `@param` `{number}` `offset` - start writing into output at offset byte;
negative offset starts from the end of the output buffer
* `@param` `{number}` `length` - a number of bytes to write from calculated hash;
negative length starts from the end of the hash;
if absolute value of length is larger than the size of calculated
hash, bytes are written only up to the hash size
* `@param` `{string}` `output_type` - a string indicating return type:
- "number" - (default) for murmurHash32 an unsigned 32-bit integer,
other hashes - hexadecimal string
- "hex" - hexadecimal string
- "base64" - base64 string
- "binary" - binary string
- "buffer" - a new Buffer object;
* `@param` `{Function}` `callback` - optional callback(err, result)
if provided the hash will be calculated asynchronously using libuv
worker queue, the return value in this instance will be `undefined`
and the result will be provided to the callback function;
Be carefull as reading and writing by multiple threads to the same
memory may render undetermined results

* `@return` `{number|Buffer|String|undefined}`

The order of bytes written to a Buffer or encoded string depends on
function's endianness.

`data` and `output` arguments might reference the same Buffer object
or buffers referencing the same memory (views).

@return {number|Buffer|String|undefined}
```

There are additional namespaces, each for different variant of function endianness:

Expand Down
2 changes: 1 addition & 1 deletion src/nodemurmurhash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace MurmurHash {
* negative offset starts from the end of the output buffer
* @param {number} length - a number of bytes to write from calculated hash;
* negative length starts from the end of the hash;
* if absolute value of length is larger than the size of a calculated
* if absolute value of length is larger than the size of calculated
* hash, bytes are written only up to the hash size
* @param {string} output_type - a string indicating return type:
* 'number' - for murmurHash32 an unsigned 32-bit integer,
Expand Down

0 comments on commit 8d3a3ca

Please sign in to comment.