push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
[![power-assert][power-assert-banner]][power-assert-url]
[![Build Status][travis-image]][travis-url]
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]
Produces graph of each value in expression.
```
assert(a.name === 'bar')
| | |
| | false
| "foo"
Object{name:"foo"}
```
USAGE
---------------------------------------
`var DiagramRenderer = require('power-assert-renderer-diagram');`
#### options.stringify
| type | default value |
|:-----------|:--------------|
| `function` | [stringifier module](https://github.com/twada/stringifier) |
Function to stringify any target value.
#### options.maxDepth
| type | default value |
|:---------|:--------------|
| `number` | `2` |
Depth of object traversal. If object depth is greater than `maxDepth`, compound object (IOW, `Array` or `object`) will be pruned with `#` like `["foo",#Array#,#Object#]`.
#### options.lineSeparator
| type | default value |
|:---------|:--------------|
| `string` | `"\n"` |
Line separator in power assert output.
#### options.anonymous
| type | default value |
|:---------|:--------------|
| `string` | `"Object"` |
Type name to show when target object is created by anonymous constructor.
#### options.circular
| type | default value |
|:---------|:----------------|
| `string` | `"#@Circular#"` |
Name to show when target object is detected as circular structure.
#### options.widthOf
| type | default value |
|:-----------|:--------------|
| `function` | [power-assert-util-string-width](https://github.com/twada/power-assert-runtime/blob/master/packages/power-assert-util-string-width) |
Function to calculate width of string.
#### options.ambiguousEastAsianCharWidth
| type | default value |
|:---------|:--------------|
| `number` | `2` |
Width of 'Ambiguous' characters defined in [Unicode Standard Annex \#11 EAST ASIAN WIDTH](http://www.unicode.org/reports/tr11/#Ambiguous). Configure `options.ambiguousEastAsianCharWidth` to treat ambiguous east asian character as fullwidth (= `2`) or narrow (= `1`). Default is `2`.
INSTALL
---------------------------------------
```sh
$ npm install --save-dev power-assert-renderer-diagram
```
AUTHOR
---------------------------------------
* [Takuto Wada](https://github.com/twada)
LICENSE
---------------------------------------
Licensed under the [MIT](https://github.com/twada/power-assert-runtime/blob/master/LICENSE) license.
[power-assert-url]: https://github.com/power-assert-js/power-assert
[power-assert-banner]: https://raw.githubusercontent.com/power-assert-js/power-assert-js-logo/master/banner/banner-official-fullcolor.png
[travis-url]: https://travis-ci.org/twada/power-assert-runtime
[travis-image]: https://secure.travis-ci.org/twada/power-assert-runtime.svg?branch=master
[npm-url]: https://npmjs.org/package/power-assert-renderer-diagram
[npm-image]: https://badge.fury.io/js/power-assert-renderer-diagram.svg
[license-url]: https://github.com/twada/power-assert-runtime/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg

View File

@@ -0,0 +1,127 @@
'use strict';
var BaseRenderer = require('power-assert-renderer-base');
var inherits = require('util').inherits;
var forEach = require('core-js/library/fn/array/for-each');
var stringifier = require('stringifier');
var stringWidth = require('power-assert-util-string-width');
var assign = require('core-js/library/fn/object/assign');
var defaultOptions = require('./lib/default-options');
/**
* options.stringify [function]
* options.maxDepth [number]
* options.lineSeparator [string]
* options.anonymous [string]
* options.circular [string]
*
* options.widthOf [function]
* options.ambiguousEastAsianCharWidth [number]
*/
function DiagramRenderer (config) {
BaseRenderer.call(this);
this.config = assign({}, defaultOptions(), config);
this.events = [];
if (typeof this.config.stringify === 'function') {
this.stringify = this.config.stringify;
} else {
this.stringify = stringifier(this.config);
}
if (typeof this.config.widthOf === 'function') {
this.widthOf = this.config.widthOf;
} else {
this.widthOf = (this.config.ambiguousEastAsianCharWidth === 1) ? stringWidth.narrow : stringWidth;
}
this.initialVertivalBarLength = 1;
}
inherits(DiagramRenderer, BaseRenderer);
DiagramRenderer.prototype.onStart = function (context) {
this.assertionLine = context.source.content;
this.initializeRows();
};
DiagramRenderer.prototype.onData = function (esNode) {
if (!esNode.isCaptured) {
return;
}
this.events.push({value: esNode.value, leftIndex: esNode.range[0]});
};
DiagramRenderer.prototype.onEnd = function () {
this.events.sort(rightToLeft);
this.constructRows(this.events);
var _this = this;
forEach(this.rows, function (columns) {
_this.write(columns.join(''));
});
};
DiagramRenderer.prototype.initializeRows = function () {
this.rows = [];
for (var i = 0; i <= this.initialVertivalBarLength; i += 1) {
this.addOneMoreRow();
}
};
DiagramRenderer.prototype.newRowFor = function (assertionLine) {
return createRow(this.widthOf(assertionLine), ' ');
};
DiagramRenderer.prototype.addOneMoreRow = function () {
this.rows.push(this.newRowFor(this.assertionLine));
};
DiagramRenderer.prototype.lastRow = function () {
return this.rows[this.rows.length - 1];
};
DiagramRenderer.prototype.renderVerticalBarAt = function (columnIndex) {
var i, lastRowIndex = this.rows.length - 1;
for (i = 0; i < lastRowIndex; i += 1) {
this.rows[i].splice(columnIndex, 1, '|');
}
};
DiagramRenderer.prototype.renderValueAt = function (columnIndex, dumpedValue) {
var i, width = this.widthOf(dumpedValue);
for (i = 0; i < width; i += 1) {
this.lastRow().splice(columnIndex + i, 1, dumpedValue.charAt(i));
}
};
DiagramRenderer.prototype.isOverlapped = function (prevCapturing, nextCaputuring, dumpedValue) {
return (typeof prevCapturing !== 'undefined') && this.startColumnFor(prevCapturing) <= (this.startColumnFor(nextCaputuring) + this.widthOf(dumpedValue));
};
DiagramRenderer.prototype.constructRows = function (capturedEvents) {
var that = this;
var prevCaptured;
forEach(capturedEvents, function (captured) {
var dumpedValue = that.stringify(captured.value);
if (that.isOverlapped(prevCaptured, captured, dumpedValue)) {
that.addOneMoreRow();
}
that.renderVerticalBarAt(that.startColumnFor(captured));
that.renderValueAt(that.startColumnFor(captured), dumpedValue);
prevCaptured = captured;
});
};
DiagramRenderer.prototype.startColumnFor = function (captured) {
return this.widthOf(this.assertionLine.slice(0, captured.leftIndex));
};
function createRow (numCols, initial) {
var row = [], i;
for(i = 0; i < numCols; i += 1) {
row[i] = initial;
}
return row;
}
function rightToLeft (a, b) {
return b.leftIndex - a.leftIndex;
}
module.exports = DiagramRenderer;

View File

@@ -0,0 +1,13 @@
'use strict';
module.exports = function defaultOptions () {
return {
ambiguousEastAsianCharWidth: 2,
maxDepth: 2,
indent: null,
outputOffset: 2,
anonymous: 'Object',
circular: '#@Circular#',
lineSeparator: '\n'
};
};

View File

@@ -0,0 +1,66 @@
{
"_from": "power-assert-renderer-diagram@^1.0.7",
"_id": "power-assert-renderer-diagram@1.2.0",
"_inBundle": false,
"_integrity": "sha512-JZ6PC+DJPQqfU6dwSmpcoD7gNnb/5U77bU5KgNwPPa+i1Pxiz6UuDeM3EUBlhZ1HvH9tMjI60anqVyi5l2oNdg==",
"_location": "/power-assert-renderer-diagram",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "power-assert-renderer-diagram@^1.0.7",
"name": "power-assert-renderer-diagram",
"escapedName": "power-assert-renderer-diagram",
"rawSpec": "^1.0.7",
"saveSpec": null,
"fetchSpec": "^1.0.7"
},
"_requiredBy": [
"/power-assert-formatter"
],
"_resolved": "https://registry.npmjs.org/power-assert-renderer-diagram/-/power-assert-renderer-diagram-1.2.0.tgz",
"_shasum": "37f66e8542e5677c5b58e6d72b01c0d9a30e2219",
"_spec": "power-assert-renderer-diagram@^1.0.7",
"_where": "C:\\Users\\jlevi\\Downloads\\tr2022-strategy-master\\tr2022-strategy-master\\data analysis\\functions\\node_modules\\power-assert-formatter",
"author": {
"name": "Takuto Wada",
"email": "takuto.wada@gmail.com",
"url": "https://github.com/twada"
},
"bugs": {
"url": "https://github.com/twada/power-assert-runtime/issues"
},
"bundleDependencies": false,
"dependencies": {
"core-js": "^2.0.0",
"power-assert-renderer-base": "^1.1.1",
"power-assert-util-string-width": "^1.2.0",
"stringifier": "^1.3.0"
},
"deprecated": false,
"description": "diagram renderer for power-assert context",
"devDependencies": {
"mocha": "^5.0.0",
"power-assert-renderer-assertion": "^1.2.0"
},
"files": [
"README.md",
"index.js",
"lib"
],
"homepage": "https://github.com/twada/power-assert-runtime",
"keywords": [
"power-assert"
],
"license": "MIT",
"main": "index.js",
"name": "power-assert-renderer-diagram",
"repository": {
"type": "git",
"url": "git+https://github.com/twada/power-assert-runtime.git"
},
"scripts": {
"test": "mocha"
},
"version": "1.2.0"
}