-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework readme #32
Rework readme #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments as of d869456. Nothing criminal, but I feel that there is room for improvement.
README.md
Outdated
@@ -1,858 +1,304 @@ | |||
# Client for Exonum blockchain platform | |||
|
|||
JavaScript toolkit to work with Exonum blockchain from both of browser and Node.js. | |||
This is JavaScript toolkit to work with Exonum blockchain from browser and Node.js. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I think a variant of
exonum-client is a JavaScript toolkit ...
is more popular with READMEs of packages in npm.
README.md
Outdated
|
||
Returns an object of format type. | ||
Each primitive data type has its own segment length (`size`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this paragraph upper, directly after the "field structure" table.
README.md
Outdated
|
||
##### newType.serialize(data) | ||
Total length of the byte array must be also specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this duplicates the information from the "field structure" table and can be safely removed.
README.md
Outdated
|
||
#### Timespec | ||
All this operations are useful while work with a blockchain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick/grammar: "These operations are useful in working with an Exonum blockchain."
README.md
Outdated
|
||
Unsigned integer value of the length of `8` bytes. Represents Unix time in nanosecond. | ||
To describe a custom data structure next basic primitive data types can be used: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"To describe" seems pretty vague. I'd say that these types can be used as the type
field of the field description.
README.md
Outdated
var secretKey = '6752be882314f5bbbc9a6af2ae634fc07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a1f2f07703c5bcafb5749aa735ce8b7c36'; | ||
|
||
var signature = someType.sign(secretKey, data); | ||
var secretKey = '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: maybe, split private key/signature into 2 lines to improve readability?
README.md
Outdated
|
||
##### newMessage.serialize(data, cutSignature) | ||
Field structure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, just refer to a section above instead of repeating the table?
README.md
Outdated
|
||
--- | ||
Returns random `Uint64` of cryptographic quality as a string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... as a hexadecimal string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it is not a hexadecimal string, just number passed as string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
Returns random `Uint64` of cryptographic quality as a number passed as string.
README.md
Outdated
|
||
| Type | Size (bytes) | Description | | ||
|---|---|---| | ||
| `string` | `8` | String of UTF-8 characters | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The size of 8 bytes may be confusing.
README.md
Outdated
|
||
| Type | Size (bytes) | Description | | ||
|---|---|---| | ||
| `Array` | any | Array of 8-bit unsigned integers | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Size: any" can be confusing, imo. The size is fixed in the field declaration, right? Maybe, write it here explicitly?
@slowli ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick comments as of 441acf3.
README.md
Outdated
@@ -35,7 +37,7 @@ Requires a single parameter passed as `object` with next structure: | |||
| size | `number` | yes | The total length in bytes | | |||
| fields | `Array` | yes | Array of fields | | |||
|
|||
Field structure: | |||
###### Field structure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use level-6 header here? I'd either remove a header formatting altogether, or use level-4 as implied by the hierarchical structure of the document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason I've used header here is to have anchor. It is used below in newMessage section:
Field structure is the same as for [custom type](#fieldstructure) defined through `Exonum.newType` method.
Changed it to level-4 header.
README.md
Outdated
--- | ||
| Field | Type | Is mandatory | Description | | ||
|---|---|---|---| | ||
| type | built-in primitive type / entity of a `NewClass` | yes | Field type. Can contains fields of a `NewType` types | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewClass
Do you mean NewType
?
README.md
Outdated
|
||
#### newType | ||
- serialize data into a byte array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I'd remove blank lines between list items here to get consistent formatting with a list of built-in types below.
Similar nitpicks below.
README.md
Outdated
|
||
##### newType.serialize(data) | ||
These types can be used as the `type` field of the field description: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: "These" -> "The following".
README.md
Outdated
name: {type: Exonum.String, size: 8, from: 8, to: 16} | ||
} | ||
}); | ||
And it is necessary to specify segment range in the resulting byte array (`from` and `to`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: remove "And" and unite with the previous sentence into a single paragraph.
README.md
Outdated
|
||
var signature = someType.sign(secretKey, data); | ||
var secretKey = '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a | ||
1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By splitting, I meant producing valid JS code:
var secretKey = '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a'
+ '1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc';
README.md
Outdated
protocol_version: 0, | ||
service_id: 0, | ||
message_id: 0, | ||
signature: '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: a signature here can be split to 2 lines.
README.md
Outdated
|
||
``` | ||
$ grunt | ||
``` | ||
|
||
#### Test | ||
## Test coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't see coverage tasks in Gruntfile.js
, and there seemingly aren't any coverage-related dev dependencies (such as istanbul
). If you don't mean measuring test coverage here, I think "Testing" could be a better header caption.
@slowli changes applied, ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as of 66e566c. Probably will need to add a bunch of badges once we go public, but this can wait.
README.md
Outdated
|---|---|---| | ||
| `string` | `8`* | String of UTF-8 characters | | ||
|
||
*\*Note that the size of 8 bytes is due to the specifics of string [serialization](http://exonum.com/doc/advanced/serialization). Actual string length is not limited.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: well, it's limited by the general message size limits (2 MB, afaik).
|
||
``` | ||
$ npm install | ||
``` | ||
|
||
To build minimised and development versions of library execute: | ||
Compile browser version into `dist` folder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment: technically, the prepublish
command (which includes building the browser version) executes during npm install
in npm < 5
😃 So, in some cases, this step may be redundant.
No description provided.