Skip to content

Commit

Permalink
Minimal documentation for micromodules
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Dec 11, 2016
1 parent f3a9589 commit 11d844c
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 18 deletions.
6 changes: 3 additions & 3 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/protobuf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "protobufjs",
"version": "6.1.0",
"description": "Protocol Buffers for JavaScript.",
"author": "Daniel Wirtz",
"author": "Daniel Wirtz <[email protected]>",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
14 changes: 14 additions & 0 deletions src/util/base64/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
@protobufjs/base64
==================
[![npm](https://img.shields.io/npm/v/@protobufjs/base64.svg)](https://www.npmjs.com/package/@protobufjs/base64)

A minimal base64 implementation for number arrays.

API
---

* **base64.length(string: `string`): `number`**<br />
Calculates the byte length of a base64 encoded string.

* **base64.encode(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**<br />
Encodes a buffer to a base64 encoded string.

* **base64.decode(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**<br />
Decodes a base64 encoded string to a buffer.

**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
2 changes: 1 addition & 1 deletion src/util/base64/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var base64 = exports;

/**
* Calculates the base64 byte length of a string.
* Calculates the byte length of a base64 encoded string.
* @param {string} string Base64 encoded string
* @returns {number} Byte length
*/
Expand Down
2 changes: 1 addition & 1 deletion src/util/base64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@protobufjs/base64",
"description": "A minimal base64 implementation for number arrays.",
"version": "1.0.0",
"author": "Daniel Wirtz <[email protected]>",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"repository": {
"type": "git",
"url": "https://github.com/dcodeIO/protobuf.js.git"
Expand Down
16 changes: 15 additions & 1 deletion src/util/codegen/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
@protobufjs/codegen
===================
[![npm](https://img.shields.io/npm/v/@protobufjs/codegen.svg)](https://www.npmjs.com/package/@protobufjs/codegen)

A closure for generating functions programmatically.

**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
API
---

* **codegen(...params: `string`): `function(format: string, ...args: string): self`**<br />
Begins generating a function programmatically.

* **codegen#str([name: `string`]): `string`**<br />
Stringifies the so far generated function source.

* **codegen#eof([name?: `string`], [scope: `Object`]): `function`**<br />
Ends generation and builds the function whilst applying a scope.

**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
2 changes: 1 addition & 1 deletion src/util/codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@protobufjs/codegen",
"description": "A closure for generating functions programmatically.",
"version": "1.0.0",
"author": "Daniel Wirtz <[email protected]>",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"repository": {
"type": "git",
"url": "https://github.com/dcodeIO/protobuf.js.git"
Expand Down
17 changes: 17 additions & 0 deletions src/util/eventemitter/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
@protobufjs/eventemitter
========================
[![npm](https://img.shields.io/npm/v/@protobufjs/eventemitter.svg)](https://www.npmjs.com/package/@protobufjs/eventemitter)

A minimal event emitter.

API
---

* **new EventEmitter()**<br />
Constructs a new event emitter instance.

* **EventEmitter#on(evt: `string`, fn: `function`, [ctx: `Object`]): `EventEmitter`**<br />
Registers an event listener.

* **EventEmitter#off([evt: `string`], [fn: `function`]): `EventEmitter`**<br />
Removes an event listener or any matching listeners if arguments are omitted.

* **EventEmitter#emit(evt: `string`, ...args: `*`): `EventEmitter`**<br />
Emits an event by calling its listeners with the specified arguments.

**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
2 changes: 1 addition & 1 deletion src/util/eventemitter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ EventEmitterPrototype.on = function on(evt, fn, ctx) {
};

/**
* Removes an event listener.
* Removes an event listener or any matching listeners if arguments are omitted.
* @param {string} [evt] Event name. Removes all listeners if omitted.
* @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
* @returns {util.EventEmitter} `this`
Expand Down
2 changes: 1 addition & 1 deletion src/util/eventemitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@protobufjs/eventemitter",
"description": "A minimal event emitter.",
"version": "1.0.0",
"author": "Daniel Wirtz <[email protected]>",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"repository": {
"type": "git",
"url": "https://github.com/dcodeIO/protobuf.js.git"
Expand Down
8 changes: 8 additions & 0 deletions src/util/pool/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
@protobufjs/pool
================
[![npm](https://img.shields.io/npm/v/@protobufjs/pool.svg)](https://www.npmjs.com/package/@protobufjs/pool)

A general purpose buffer pool.

API
---

* **pool(alloc: `function(size: number): Uint8Array`, slice: `function(this: Uint8Array, start: number, end: number): Uint8Array`, [size=8192: `number`]): `function(size: number): Uint8Array`**<br />
Creates a pooled allocator.

**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
2 changes: 1 addition & 1 deletion src/util/pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@protobufjs/pool",
"description": "A general purpose buffer pool.",
"version": "1.0.0",
"author": "Daniel Wirtz <[email protected]>",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"repository": {
"type": "git",
"url": "https://github.com/dcodeIO/protobuf.js.git"
Expand Down
15 changes: 15 additions & 0 deletions src/util/utf8/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
@protobufjs/utf8
================
[![npm](https://img.shields.io/npm/v/@protobufjs/utf8.svg)](https://www.npmjs.com/package/@protobufjs/utf8)

A minimal UTF8 implementation for number arrays.

API
---

* **utf8.length(string: `string`): `number`**<br />
Calculates the UTF8 byte length of a string.

* **utf8.read(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**<br />
Reads UTF8 bytes as a string.

* **utf8.write(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**<br />
Writes a string as UTF8 bytes.


**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
2 changes: 1 addition & 1 deletion src/util/utf8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@protobufjs/utf8",
"description": "A minimal UTF8 implementation for number arrays.",
"version": "1.0.0",
"author": "Daniel Wirtz <[email protected]>",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"repository": {
"type": "git",
"url": "https://github.com/dcodeIO/protobuf.js.git"
Expand Down
6 changes: 3 additions & 3 deletions types/protobuf.js.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* protobuf.js v6.1.0 TypeScript definitions
* Generated Sat, 10 Dec 2016 23:38:42 UTC
* Generated Sun, 11 Dec 2016 00:46:04 UTC
*/
declare module "protobufjs" {

Expand Down Expand Up @@ -1657,7 +1657,7 @@ declare module "protobufjs" {
*/
module base64 {
/**
* Calculates the base64 byte length of a string.
* Calculates the byte length of a base64 encoded string.
* @param {string} string Base64 encoded string
* @returns {number} Byte length
*/
Expand Down Expand Up @@ -1721,7 +1721,7 @@ declare module "protobufjs" {
on(evt: string, fn: (() => any), ctx?: Object): util.EventEmitter;

/**
* Removes an event listener.
* Removes an event listener or any matching listeners if arguments are omitted.
* @param {string} [evt] Event name. Removes all listeners if omitted.
* @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
* @returns {util.EventEmitter} `this`
Expand Down

0 comments on commit 11d844c

Please sign in to comment.