code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function append (key, value) {
var
self = this;
if (!has.call(self, key)) {
self._data[key] = [];
}
self._data[key].push(value);
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
append
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function deleteFn (key) {
delete this._data[key];
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
deleteFn
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function getAll (key) {
return this._data[key] || null;
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
getAll
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function get (key) {
var
values = getAll.call(this, key);
return values ? values[0] : null;
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
get
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function set (key, value) {
this._data[key] = [value];
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
set
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function createBoundary () {
// for XHR
var random = math.random;
var salt = (random() * math.pow(10, ((random() * 12) | 0) + 1));
var hash = (random() * salt).toString(36);
return '----------------FormData-' + hash;
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
createBoundary
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function parseContents (children) {
var
child,
counter,
counter2,
length,
length2,
name,
option,
self = this;
for (counter = 0, length = children.length; counter < length; counter += 1) {
child = children[counter];
name = child.name || child.id;
if (!name || child.disabled) {
continue;
}
switch (child.type) {
case 'checkbox':
if (child.checked) {
self.append(name, child.value || 'on');
}
break;
// x/y coordinates or origin if missing
case 'image':
self.append(name + '.x', child.x || 0);
self.append(name + '.y', child.y || 0);
break;
case 'radio':
if (child.checked) {
// using .set as only one can be valid (uses last one if more discovered)
self.set(name, child.value);
}
break;
case 'select-one':
if (child.selectedIndex !== -1) {
self.append(name, child.options[child.selectedIndex].value);
}
break;
case 'select-multiple':
for (counter2 = 0, length2 = child.options.length; counter2 < length2; counter2 += 1) {
option = child.options[counter2];
if (option.selected) {
self.append(name, option.value);
}
}
break;
case 'file':
case 'reset':
case 'submit':
break;
default: // hidden, text, textarea, password
self.append(name, child.value);
}
}
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
parseContents
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function toString () {
var
self = this,
body = [],
data = self._data,
key,
prefix = '--';
for (key in data) {
if (data.hasOwnProperty(key)) {
body.push(prefix + self._boundary); // boundaries are prefixed with '--'
// only form fields for now, files can wait / probably can't be done
body.push('Content-Disposition: form-data; name="' + key + '"\r\n'); // two linebreaks between definition and content
body.push(data[key]);
}
}
if (body.length) {
return body.join('\r\n') + '\r\n' + prefix + self._boundary + prefix; // form content ends with '--'
}
return '';
}
|
@description placeholder polyfill for IE9
only support one line
no consideration of settings placeholder attr
@author zhangxinxu(.com)
@created 2019-08-09
|
toString
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function FormData (form) {
var
self = this;
if (!(self instanceof FormData)) {
return new FormData(form);
}
if (form && (!form.tagName || form.tagName !== 'FORM')) { // not a form
return;
}
self._boundary = createBoundary();
self._data = {};
if (!form) { // nothing to parse, we're done here
return;
}
parseContents.call(self, form.children);
}
|
[FormData description]
@contructor
@param {?HTMLForm} form HTML <form> element to populate the object (optional)
|
FormData
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
function send (data) {
var
self = this;
if (data instanceof FormData) {
self.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + data._boundary);
return xhrSend.call(self, data.toString());
}
return xhrSend.call(self, data || null);
}
|
[FormData description]
@contructor
@param {?HTMLForm} form HTML <form> element to populate the object (optional)
|
send
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/polyfill.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
|
MIT
|
U = function (a, b) {
if (!a) {
return '';
}
b = b || 'x';
var c = '';
var d = 0;
var e;
for (d; d < a.length; d += 1) a.charCodeAt(d) >= 55296 && a.charCodeAt(d) <= 56319 ? (e = (65536 + 1024 * (Number(a.charCodeAt(d)) - 55296) + Number(a.charCodeAt(d + 1)) - 56320).toString(16), d += 1) : e = a.charCodeAt(d).toString(16), c += b + e;
return c.substr(b.length);
}
|
@Keyboard.js
@author zhangxinxu
@version
Created: 17-06-13
|
U
|
javascript
|
yued-fe/lulu
|
theme/pure/js/common/ui/Keyboard.js
|
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/ui/Keyboard.js
|
MIT
|
function BufferList(context, bufferData, options) {
this._context = Utils.isAudioContext(context) ?
context :
Utils.throw('BufferList: Invalid BaseAudioContext.');
this._options = {
dataType: BufferDataType.BASE64,
verbose: false,
};
if (options) {
if (options.dataType &&
Utils.isDefinedENUMEntry(BufferDataType, options.dataType)) {
this._options.dataType = options.dataType;
}
if (options.verbose) {
this._options.verbose = Boolean(options.verbose);
}
}
this._bufferList = [];
this._bufferData = this._options.dataType === BufferDataType.BASE64
? bufferData
: bufferData.slice(0);
this._numberOfTasks = this._bufferData.length;
this._resolveHandler = null;
this._rejectHandler = new Function();
}
|
BufferList object mananges the async loading/decoding of multiple
AudioBuffers from multiple URLs.
@constructor
@param {BaseAudioContext} context - Associated BaseAudioContext.
@param {string[]} bufferData - An ordered list of URLs.
@param {Object} options - Options
@param {string} [options.dataType='base64'] - BufferDataType specifier.
@param {Boolean} [options.verbose=false] - Log verbosity. |true| prints the
individual message from each URL and AudioBuffer.
|
BufferList
|
javascript
|
GoogleChrome/omnitone
|
src/buffer-list.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/buffer-list.js
|
Apache-2.0
|
function FOAConvolver(context, hrirBufferList) {
this._context = context;
this._active = false;
this._isBufferLoaded = false;
this._buildAudioGraph();
if (hrirBufferList) {
this.setHRIRBufferList(hrirBufferList);
}
this.enable();
}
|
FOAConvolver. A collection of 2 stereo convolvers for 4-channel FOA stream.
@constructor
@param {BaseAudioContext} context The associated AudioContext.
@param {AudioBuffer[]} [hrirBufferList] - An ordered-list of stereo
AudioBuffers for convolution. (i.e. 2 stereo AudioBuffers for FOA)
|
FOAConvolver
|
javascript
|
GoogleChrome/omnitone
|
src/foa-convolver.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/foa-convolver.js
|
Apache-2.0
|
function FOARenderer(context, config) {
this._context = Utils.isAudioContext(context) ?
context :
Utils.throw('FOARenderer: Invalid BaseAudioContext.');
this._config = {
channelMap: FOARouter.ChannelMap.DEFAULT,
renderingMode: RenderingMode.AMBISONIC,
};
if (config) {
if (config.channelMap) {
if (Array.isArray(config.channelMap) && config.channelMap.length === 4) {
this._config.channelMap = config.channelMap;
} else {
Utils.throw(
'FOARenderer: Invalid channel map. (got ' + config.channelMap
+ ')');
}
}
if (config.hrirPathList) {
if (Array.isArray(config.hrirPathList) &&
config.hrirPathList.length === 2) {
this._config.pathList = config.hrirPathList;
} else {
Utils.throw(
'FOARenderer: Invalid HRIR URLs. It must be an array with ' +
'2 URLs to HRIR files. (got ' + config.hrirPathList + ')');
}
}
if (config.renderingMode) {
if (Object.values(RenderingMode).includes(config.renderingMode)) {
this._config.renderingMode = config.renderingMode;
} else {
Utils.log(
'FOARenderer: Invalid rendering mode order. (got' +
config.renderingMode + ') Fallbacks to the mode "ambisonic".');
}
}
}
this._buildAudioGraph();
this._tempMatrix4 = new Float32Array(16);
this._isRendererReady = false;
}
|
Omnitone FOA renderer class. Uses the optimized convolution technique.
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Object} config
@param {Array} [config.channelMap] - Custom channel routing map. Useful for
handling the inconsistency in browser's multichannel audio decoding.
@param {Array} [config.hrirPathList] - A list of paths to HRIR files. It
overrides the internal HRIR list if given.
@param {RenderingMode} [config.renderingMode='ambisonic'] - Rendering mode.
|
FOARenderer
|
javascript
|
GoogleChrome/omnitone
|
src/foa-renderer.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/foa-renderer.js
|
Apache-2.0
|
function FOARotator(context) {
this._context = context;
this._splitter = this._context.createChannelSplitter(4);
this._inY = this._context.createGain();
this._inZ = this._context.createGain();
this._inX = this._context.createGain();
this._m0 = this._context.createGain();
this._m1 = this._context.createGain();
this._m2 = this._context.createGain();
this._m3 = this._context.createGain();
this._m4 = this._context.createGain();
this._m5 = this._context.createGain();
this._m6 = this._context.createGain();
this._m7 = this._context.createGain();
this._m8 = this._context.createGain();
this._outY = this._context.createGain();
this._outZ = this._context.createGain();
this._outX = this._context.createGain();
this._merger = this._context.createChannelMerger(4);
// ACN channel ordering: [1, 2, 3] => [-Y, Z, -X]
// Y (from channel 1)
this._splitter.connect(this._inY, 1);
// Z (from channel 2)
this._splitter.connect(this._inZ, 2);
// X (from channel 3)
this._splitter.connect(this._inX, 3);
this._inY.gain.value = -1;
this._inX.gain.value = -1;
// Apply the rotation in the world space.
// |Y| | m0 m3 m6 | | Y * m0 + Z * m3 + X * m6 | | Yr |
// |Z| * | m1 m4 m7 | = | Y * m1 + Z * m4 + X * m7 | = | Zr |
// |X| | m2 m5 m8 | | Y * m2 + Z * m5 + X * m8 | | Xr |
this._inY.connect(this._m0);
this._inY.connect(this._m1);
this._inY.connect(this._m2);
this._inZ.connect(this._m3);
this._inZ.connect(this._m4);
this._inZ.connect(this._m5);
this._inX.connect(this._m6);
this._inX.connect(this._m7);
this._inX.connect(this._m8);
this._m0.connect(this._outY);
this._m1.connect(this._outZ);
this._m2.connect(this._outX);
this._m3.connect(this._outY);
this._m4.connect(this._outZ);
this._m5.connect(this._outX);
this._m6.connect(this._outY);
this._m7.connect(this._outZ);
this._m8.connect(this._outX);
// Transform 3: world space to audio space.
// W -> W (to channel 0)
this._splitter.connect(this._merger, 0, 0);
// Y (to channel 1)
this._outY.connect(this._merger, 0, 1);
// Z (to channel 2)
this._outZ.connect(this._merger, 0, 2);
// X (to channel 3)
this._outX.connect(this._merger, 0, 3);
this._outY.gain.value = -1;
this._outX.gain.value = -1;
this.setRotationMatrix3(new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]));
// input/output proxy.
this.input = this._splitter;
this.output = this._merger;
}
|
First-order-ambisonic decoder based on gain node network.
@constructor
@param {AudioContext} context - Associated AudioContext.
|
FOARotator
|
javascript
|
GoogleChrome/omnitone
|
src/foa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/foa-rotator.js
|
Apache-2.0
|
function FOARouter(context, channelMap) {
this._context = context;
this._splitter = this._context.createChannelSplitter(4);
this._merger = this._context.createChannelMerger(4);
// input/output proxy.
this.input = this._splitter;
this.output = this._merger;
this.setChannelMap(channelMap || ChannelMap.DEFAULT);
}
|
Channel router for FOA stream.
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Number[]} channelMap - Routing destination array.
|
FOARouter
|
javascript
|
GoogleChrome/omnitone
|
src/foa-router.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/foa-router.js
|
Apache-2.0
|
function HOAConvolver(context, ambisonicOrder, hrirBufferList) {
this._context = context;
this._active = false;
this._isBufferLoaded = false;
// The number of channels K based on the ambisonic order N where K = (N+1)^2.
this._ambisonicOrder = ambisonicOrder;
this._numberOfChannels =
(this._ambisonicOrder + 1) * (this._ambisonicOrder + 1);
this._buildAudioGraph();
if (hrirBufferList) {
this.setHRIRBufferList(hrirBufferList);
}
this.enable();
}
|
A convolver network for N-channel HOA stream.
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Number} ambisonicOrder - Ambisonic order. (2 or 3)
@param {AudioBuffer[]} [hrirBufferList] - An ordered-list of stereo
AudioBuffers for convolution. (SOA: 5 AudioBuffers, TOA: 8 AudioBuffers)
|
HOAConvolver
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-convolver.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-convolver.js
|
Apache-2.0
|
function HOARenderer(context, config) {
this._context = Utils.isAudioContext(context) ?
context :
Utils.throw('HOARenderer: Invalid BaseAudioContext.');
this._config = {
ambisonicOrder: 3,
renderingMode: RenderingMode.AMBISONIC,
};
if (config && config.ambisonicOrder) {
if (SupportedAmbisonicOrder.includes(config.ambisonicOrder)) {
this._config.ambisonicOrder = config.ambisonicOrder;
} else {
Utils.log(
'HOARenderer: Invalid ambisonic order. (got ' +
config.ambisonicOrder + ') Fallbacks to 3rd-order ambisonic.');
}
}
this._config.numberOfChannels =
(this._config.ambisonicOrder + 1) * (this._config.ambisonicOrder + 1);
this._config.numberOfStereoChannels =
Math.ceil(this._config.numberOfChannels / 2);
if (config && config.hrirPathList) {
if (Array.isArray(config.hrirPathList) &&
config.hrirPathList.length === this._config.numberOfStereoChannels) {
this._config.pathList = config.hrirPathList;
} else {
Utils.throw(
'HOARenderer: Invalid HRIR URLs. It must be an array with ' +
this._config.numberOfStereoChannels + ' URLs to HRIR files.' +
' (got ' + config.hrirPathList + ')');
}
}
if (config && config.renderingMode) {
if (Object.values(RenderingMode).includes(config.renderingMode)) {
this._config.renderingMode = config.renderingMode;
} else {
Utils.log(
'HOARenderer: Invalid rendering mode. (got ' +
config.renderingMode + ') Fallbacks to "ambisonic".');
}
}
this._buildAudioGraph();
this._isRendererReady = false;
}
|
Omnitone HOA renderer class. Uses the optimized convolution technique.
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Object} config
@param {Number} [config.ambisonicOrder=3] - Ambisonic order.
@param {Array} [config.hrirPathList] - A list of paths to HRIR files. It
overrides the internal HRIR list if given.
@param {RenderingMode} [config.renderingMode='ambisonic'] - Rendering mode.
|
HOARenderer
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-renderer.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-renderer.js
|
Apache-2.0
|
function getKroneckerDelta(i, j) {
return i === j ? 1 : 0;
}
|
Kronecker Delta function.
@param {Number} i
@param {Number} j
@return {Number}
|
getKroneckerDelta
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function setCenteredElement(matrix, l, i, j, gainValue) {
const index = (j + l) * (2 * l + 1) + (i + l);
// Row-wise indexing.
matrix[l - 1][index].gain.value = gainValue;
}
|
A helper function to allow us to access a matrix array in the same
manner, assuming it is a (2l+1)x(2l+1) matrix. [2] uses an odd convention of
referring to the rows and columns using centered indices, so the middle row
and column are (0, 0) and the upper left would have negative coordinates.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} l
@param {Number} i
@param {Number} j
@param {Number} gainValue
|
setCenteredElement
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function getCenteredElement(matrix, l, i, j) {
// Row-wise indexing.
const index = (j + l) * (2 * l + 1) + (i + l);
return matrix[l - 1][index].gain.value;
}
|
This is a helper function to allow us to access a matrix array in the same
manner, assuming it is a (2l+1) x (2l+1) matrix.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} l
@param {Number} i
@param {Number} j
@return {Number}
|
getCenteredElement
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function getP(matrix, i, a, b, l) {
if (b === l) {
return getCenteredElement(matrix, 1, i, 1) *
getCenteredElement(matrix, l - 1, a, l - 1) -
getCenteredElement(matrix, 1, i, -1) *
getCenteredElement(matrix, l - 1, a, -l + 1);
} else if (b === -l) {
return getCenteredElement(matrix, 1, i, 1) *
getCenteredElement(matrix, l - 1, a, -l + 1) +
getCenteredElement(matrix, 1, i, -1) *
getCenteredElement(matrix, l - 1, a, l - 1);
} else {
return getCenteredElement(matrix, 1, i, 0) *
getCenteredElement(matrix, l - 1, a, b);
}
}
|
Helper function defined in [2] that is used by the functions U, V, W.
This should not be called on its own, as U, V, and W (and their coefficients)
select the appropriate matrix elements to access arguments |a| and |b|.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} i
@param {Number} a
@param {Number} b
@param {Number} l
@return {Number}
|
getP
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function getU(matrix, m, n, l) {
// Although [1, 2] split U into three cases for m == 0, m < 0, m > 0
// the actual values are the same for all three cases.
return getP(matrix, 0, m, n, l);
}
|
The functions U, V, and W should only be called if the correspondingly
named coefficient u, v, w from the function ComputeUVWCoeff() is non-zero.
When the coefficient is 0, these would attempt to access matrix elements that
are out of bounds. The vector of rotations, |r|, must have the |l - 1|
previously completed band rotations. These functions are valid for |l >= 2|.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} m
@param {Number} n
@param {Number} l
@return {Number}
|
getU
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function getV(matrix, m, n, l) {
if (m === 0) {
return getP(matrix, 1, 1, n, l) + getP(matrix, -1, -1, n, l);
} else if (m > 0) {
const d = getKroneckerDelta(m, 1);
return getP(matrix, 1, m - 1, n, l) * Math.sqrt(1 + d) -
getP(matrix, -1, -m + 1, n, l) * (1 - d);
} else {
// Note there is apparent errata in [1,2,2b] dealing with this particular
// case. [2b] writes it should be P*(1-d)+P*(1-d)^0.5
// [1] writes it as P*(1+d)+P*(1-d)^0.5, but going through the math by hand,
// you must have it as P*(1-d)+P*(1+d)^0.5 to form a 2^.5 term, which
// parallels the case where m > 0.
const d = getKroneckerDelta(m, -1);
return getP(matrix, 1, m + 1, n, l) * (1 - d) +
getP(matrix, -1, -m - 1, n, l) * Math.sqrt(1 + d);
}
}
|
The functions U, V, and W should only be called if the correspondingly
named coefficient u, v, w from the function ComputeUVWCoeff() is non-zero.
When the coefficient is 0, these would attempt to access matrix elements that
are out of bounds. The vector of rotations, |r|, must have the |l - 1|
previously completed band rotations. These functions are valid for |l >= 2|.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} m
@param {Number} n
@param {Number} l
@return {Number}
|
getV
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function getW(matrix, m, n, l) {
// Whenever this happens, w is also 0 so W can be anything.
if (m === 0) {
return 0;
}
return m > 0 ? getP(matrix, 1, m + 1, n, l) + getP(matrix, -1, -m - 1, n, l) :
getP(matrix, 1, m - 1, n, l) - getP(matrix, -1, -m + 1, n, l);
}
|
The functions U, V, and W should only be called if the correspondingly
named coefficient u, v, w from the function ComputeUVWCoeff() is non-zero.
When the coefficient is 0, these would attempt to access matrix elements that
are out of bounds. The vector of rotations, |r|, must have the |l - 1|
previously completed band rotations. These functions are valid for |l >= 2|.
@param {Number[]} matrix N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} m
@param {Number} n
@param {Number} l
@return {Number}
|
getW
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function computeUVWCoeff(m, n, l) {
const d = getKroneckerDelta(m, 0);
const reciprocalDenominator =
Math.abs(n) === l ? 1 / (2 * l * (2 * l - 1)) : 1 / ((l + n) * (l - n));
return [
Math.sqrt((l + m) * (l - m) * reciprocalDenominator),
0.5 * (1 - 2 * d) * Math.sqrt((1 + d) *
(l + Math.abs(m) - 1) *
(l + Math.abs(m)) *
reciprocalDenominator),
-0.5 * (1 - d) * Math.sqrt((l - Math.abs(m) - 1) * (l - Math.abs(m))) *
reciprocalDenominator,
];
}
|
Calculates the coefficients applied to the U, V, and W functions. Because
their equations share many common terms they are computed simultaneously.
@param {Number} m
@param {Number} n
@param {Number} l
@return {Array} 3 coefficients for U, V and W functions.
|
computeUVWCoeff
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function computeBandRotation(matrix, l) {
// The lth band rotation matrix has rows and columns equal to the number of
// coefficients within that band (-l <= m <= l implies 2l + 1 coefficients).
for (let m = -l; m <= l; m++) {
for (let n = -l; n <= l; n++) {
const uvwCoefficients = computeUVWCoeff(m, n, l);
// The functions U, V, W are only safe to call if the coefficients
// u, v, w are not zero.
if (Math.abs(uvwCoefficients[0]) > 0) {
uvwCoefficients[0] *= getU(matrix, m, n, l);
}
if (Math.abs(uvwCoefficients[1]) > 0) {
uvwCoefficients[1] *= getV(matrix, m, n, l);
}
if (Math.abs(uvwCoefficients[2]) > 0) {
uvwCoefficients[2] *= getW(matrix, m, n, l);
}
setCenteredElement(
matrix, l, m, n,
uvwCoefficients[0] + uvwCoefficients[1] + uvwCoefficients[2]);
}
}
}
|
Calculates the (2l+1) x (2l+1) rotation matrix for the band l.
This uses the matrices computed for band 1 and band l-1 to compute the
matrix for band l. |rotations| must contain the previously computed l-1
rotation matrices.
This implementation comes from p. 5 (6346), Table 1 and 2 in [2] taking
into account the corrections from [2b].
@param {Number[]} matrix - N matrices of gainNodes, each with where
n=1,2,...,N.
@param {Number} l
|
computeBandRotation
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function computeHOAMatrices(matrix) {
// We start by computing the 2nd-order matrix from the 1st-order matrix.
for (let i = 2; i <= matrix.length; i++) {
computeBandRotation(matrix, i);
}
}
|
Compute the HOA rotation matrix after setting the transform matrix.
@param {Array} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
|
computeHOAMatrices
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function HOARotator(context, ambisonicOrder) {
this._context = context;
this._ambisonicOrder = ambisonicOrder;
// We need to determine the number of channels K based on the ambisonic order
// N where K = (N + 1)^2.
const numberOfChannels = (ambisonicOrder + 1) * (ambisonicOrder + 1);
this._splitter = this._context.createChannelSplitter(numberOfChannels);
this._merger = this._context.createChannelMerger(numberOfChannels);
// Create a set of per-order rotation matrices using gain nodes.
this._gainNodeMatrix = [];
let orderOffset;
let rows;
let inputIndex;
let outputIndex;
let matrixIndex;
for (let i = 1; i <= ambisonicOrder; i++) {
// Each ambisonic order requires a separate (2l + 1) x (2l + 1) rotation
// matrix. We compute the offset value as the first channel index of the
// current order where
// k_last = l^2 + l + m,
// and m = -l
// k_last = l^2
orderOffset = i * i;
// Uses row-major indexing.
rows = (2 * i + 1);
this._gainNodeMatrix[i - 1] = [];
for (let j = 0; j < rows; j++) {
inputIndex = orderOffset + j;
for (let k = 0; k < rows; k++) {
outputIndex = orderOffset + k;
matrixIndex = j * rows + k;
this._gainNodeMatrix[i - 1][matrixIndex] = this._context.createGain();
this._splitter.connect(
this._gainNodeMatrix[i - 1][matrixIndex], inputIndex);
this._gainNodeMatrix[i - 1][matrixIndex].connect(
this._merger, 0, outputIndex);
}
}
}
// W-channel is not involved in rotation, skip straight to ouput.
this._splitter.connect(this._merger, 0, 0);
// Default Identity matrix.
this.setRotationMatrix3(new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]));
// Input/Output proxy.
this.input = this._splitter;
this.output = this._merger;
}
|
Higher-order-ambisonic decoder based on gain node network. We expect
the order of the channels to conform to ACN ordering. Below are the helper
methods to compute SH rotation using recursion. The code uses maths described
in the following papers:
[1] R. Green, "Spherical Harmonic Lighting: The Gritty Details", GDC 2003,
http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.pdf
[2] J. Ivanic and K. Ruedenberg, "Rotation Matrices for Real
Spherical Harmonics. Direct Determination by Recursion", J. Phys.
Chem., vol. 100, no. 15, pp. 6342-6347, 1996.
http://pubs.acs.org/doi/pdf/10.1021/jp953350u
[2b] Corrections to initial publication:
http://pubs.acs.org/doi/pdf/10.1021/jp9833350
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Number} ambisonicOrder - Ambisonic order.
|
HOARotator
|
javascript
|
GoogleChrome/omnitone
|
src/hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/src/hoa-rotator.js
|
Apache-2.0
|
function generateExpectedBusFromFOAIRBuffer(buffer) {
var generatedBus = new AudioBus(2, buffer.length, buffer.sampleRate);
var W = buffer.getChannelData(0);
var Y = buffer.getChannelData(1);
var Z = buffer.getChannelData(2);
var X = buffer.getChannelData(3);
var L = generatedBus.getChannelData(0);
var R = generatedBus.getChannelData(1);
for (var i = 0; i < buffer.length; ++i) {
L[i] = W[i] + Y[i] + Z[i] + X[i];
R[i] = W[i] - Y[i] + Z[i] + X[i];
}
return generatedBus;
}
|
Calculate the expected binaural rendering (based on SH-maxRE algorithm)
result from the impulse input and generate an AudioBus instance.
@param {AudioBuffer} buffer FOA SH-maxRE HRIR buffer.
@return {AudioBus}
|
generateExpectedBusFromFOAIRBuffer
|
javascript
|
GoogleChrome/omnitone
|
test/test-foa-convolver.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-foa-convolver.js
|
Apache-2.0
|
function generateExpectedBusFromTOAIRBuffer(buffer) {
// TOA IR set is 16 channels.
expect(buffer.numberOfChannels).to.equal(16);
// Derive ambisonic order from number of channels.
var ambisonicOrder = Math.floor(Math.sqrt(buffer.numberOfChannels)) - 1;
// Get pointers to each buffer.
var acnChannelData = [];
for (var i = 0; i < buffer.numberOfChannels; i++)
acnChannelData[i] = buffer.getChannelData(i);
var generatedBus = new AudioBus(2, buffer.length, buffer.sampleRate);
var L = generatedBus.getChannelData(0);
var R = generatedBus.getChannelData(1);
// We wish to exploit front-axis symmetry, hence the left output will be
// the sum of all spherical harmonics while the right output is the
// difference between the positive-m spherical harmonics and the negative-m
// spherical harmonics.
for (var i = 0; i < buffer.length; ++i) {
L[i] = 0;
R[i] = 0;
for (var l = 0; l <= ambisonicOrder; l++) {
for (var m = -l; m <= l; m++) {
var channelValue = acnChannelData[l * l + l + m];
L[i] += channelValue;
R[i] += m >= 0 ? channelValue : -channelValue;
}
}
}
return generatedBus;
}
|
Generate the expected binaural rendering (based on SH-maxRE algorithm)
result from the impulse response and generate an AudioBus instance.
@param {AudioBuffer} buffer TOA SH-maxRE HRIR buffer.
@return {AudioBus}
|
generateExpectedBusFromTOAIRBuffer
|
javascript
|
GoogleChrome/omnitone
|
test/test-hoa-convolver.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-hoa-convolver.js
|
Apache-2.0
|
function crossProduct(a, b) {
return [
a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0]
];
}
|
Compute cross-product between two 3-element vectors.
@param {Float32Array} a
@param {Float32Array} b
|
crossProduct
|
javascript
|
GoogleChrome/omnitone
|
test/test-hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-hoa-rotator.js
|
Apache-2.0
|
function generateRotationMatrix(azimuth, elevation) {
var forward = [
-Math.sin(azimuth) * Math.cos(elevation), Math.sin(elevation),
-Math.cos(azimuth) * Math.cos(elevation)
];
var right = normalize(crossProduct([0, 1, 0], forward));
var up = normalize(crossProduct(forward, right));
return right.concat(up.concat(forward));
}
|
Generate a col-major 3x3 Euler rotation matrix.
@param {Number} azimuth
@param {Number} elevation
|
generateRotationMatrix
|
javascript
|
GoogleChrome/omnitone
|
test/test-hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-hoa-rotator.js
|
Apache-2.0
|
function generateExpectedBusFromSphericalHarmonicsVector(index) {
// We need to determine the number of channels K based on the ambisonic
// order N where K = (N + 1)^2
var numberOfChannels = (ambisonicOrder + 1) * (ambisonicOrder + 1);
var generatedBus = new AudioBus(numberOfChannels, renderLength, sampleRate);
// Assign all values in each channel to a spherical harmonic coefficient.
for (var i = 0; i < numberOfChannels; i++) {
var data = generatedBus.getChannelData(i);
for (var j = 0; j < data.length; j++) {
data[j] = sphericalHarmonicsPerDirection[index][i];
}
}
return generatedBus;
}
|
Calculate the expected binaural rendering (based on SH-maxRE algorithm)
result from the impulse input and generate an AudioBus instance.
@param {AudioBuffer} buffer FOA SH-maxRE HRIR buffer.
@return {AudioBus}
|
generateExpectedBusFromSphericalHarmonicsVector
|
javascript
|
GoogleChrome/omnitone
|
test/test-hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-hoa-rotator.js
|
Apache-2.0
|
function computeRotationAndTest(index) {
it('#setRotationMatrix: rotate the incoming stream using direction [' +
sphericalDirections[index] + '].',
function(done) {
hoaRotator.setRotationMatrix3(generateRotationMatrix(
sphericalDirections[index][0], sphericalDirections[index][1]));
expectedValues = sphericalHarmonicsPerDirection[index];
context.startRendering().then(function(renderedBuffer) {
var vectorNomal = 0;
var numberOfChannels = renderedBuffer.numberOfChannels;
for (var channel = 0; channel < numberOfChannels; ++channel) {
var channelData = renderedBuffer.getChannelData(channel);
for (var i = 0; i < channelData.length; ++i)
vectorNomal +=
Math.abs(channelData[i] - expectedValues[channel]);
}
vectorNomal /= renderedBuffer.getChannelData(0).length *
renderedBuffer.numberOfChannels * vectorMagnitude;
expect(vectorNomal).to.be.below(THRESHOLD);
done();
});
});
}
|
TODO: describe this test.
@param {Function} done Test runner callback.
@param {Number} index Direction idex.
|
computeRotationAndTest
|
javascript
|
GoogleChrome/omnitone
|
test/test-hoa-rotator.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-hoa-rotator.js
|
Apache-2.0
|
function createConstantBuffer(context, values, length) {
var constantBuffer = context.createBuffer(
values.length, length, context.sampleRate);
for (var channel = 0; channel < constantBuffer.numberOfChannels; channel++) {
var channelData = constantBuffer.getChannelData(channel);
for (var index = 0; index < channelData.length; index++)
channelData[index] = values[channel];
}
return constantBuffer;
}
|
Create a buffer for testing. Each channel contains a stream of single,
user-defined value.
@param {AudioContext} context AudioContext.
@param {Array} values User-defined constant value for each
channel.
@param {Number} length Buffer length in samples.
@return {AudioBuffer}
|
createConstantBuffer
|
javascript
|
GoogleChrome/omnitone
|
test/test-setup.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-setup.js
|
Apache-2.0
|
function createImpulseBuffer(context, numberOfChannels, length) {
var impulseBuffer = context.createBuffer(
numberOfChannels, length, context.sampleRate);
for (var channel = 0; channel < impulseBuffer.numberOfChannels; channel++) {
var channelData = impulseBuffer.getChannelData(channel);
channelData[0] = 1.0;
}
return impulseBuffer;
}
|
Create a impulse buffer for testing. Each channel contains a single unity
value (1.0) at the beginning and the rest of content is all zero.
@param {AudioContext} context AudioContext
@param {Number} numberOfChannels Channel count.
@param {Number} length Buffer length in samples.
@return {AudioBuffer}
|
createImpulseBuffer
|
javascript
|
GoogleChrome/omnitone
|
test/test-setup.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-setup.js
|
Apache-2.0
|
function isConstantValueOf(channelData, value) {
var mismatches = {};
for (var i = 0; i < channelData.length; i++) {
if (channelData[i] !== value)
mismatches[i] = channelData[i];
}
return Object.keys(mismatches).length === 0;
}
|
Check if the array is filled with the specified value only.
@param {Float32Array} channelData The target array for testing.
@param {Number} value A value for the testing.
@return {Boolean}
|
isConstantValueOf
|
javascript
|
GoogleChrome/omnitone
|
test/test-setup.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-setup.js
|
Apache-2.0
|
function getDualBandFilterCoefs(crossoverFrequency, sampleRate) {
var k = Math.tan(Math.PI * crossoverFrequency / sampleRate),
k2 = k * k,
denominator = k2 + 2 * k + 1;
return {
lowpassA: [1, 2 * (k2 - 1) / denominator, (k2 - 2 * k + 1) / denominator],
lowpassB: [k2 / denominator, 2 * k2 / denominator, k2 / denominator],
hipassA: [1, 2 * (k2 - 1) / denominator, (k2 - 2 * k + 1) / denominator],
hipassB: [1 / denominator, -2 * 1 / denominator, 1 / denominator]
};
}
|
Generate the filter coefficients for the phase matched dual band filter.
@param {NUmber} crossoverFrequency Filter crossover frequency.
@param {NUmber} sampleRate Operating sample rate.
@return {Object} Filter coefficients.
{ lowpassA, lowpassB, hipassA, hipassB }
(where B is feedforward, A is feedback.)
|
getDualBandFilterCoefs
|
javascript
|
GoogleChrome/omnitone
|
test/test-setup.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-setup.js
|
Apache-2.0
|
function kernel_IIRFIlter (channelData, feedforward, feedback) {
var paddingSize = Math.max(feedforward.length, feedback.length);
var workSize = channelData.length + paddingSize;
var x = new Float32Array(workSize);
var y = new Float64Array(workSize);
x.set(channelData, paddingSize);
for (var index = paddingSize; index < workSize; ++index) {
var yn = 0;
for (k = 0; k < feedforward.length; ++k)
yn += feedforward[k] * x[index - k];
for (k = 0; k < feedback.length; ++k)
yn -= feedback[k] * y[index - k];
y[index] = yn;
}
channelData.set(y.slice(paddingSize).map(Math.fround));
}
|
Kernel processor for IIR filter. (in-place processing)
@param {Float32Array} channelData A channel data.
@param {Float32Array} feedforward Feedforward coefficients.
@param {Float32Array} feedback Feedback coefficients.
|
kernel_IIRFIlter
|
javascript
|
GoogleChrome/omnitone
|
test/test-setup.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-setup.js
|
Apache-2.0
|
function AudioBus (numberOfChannels, length, sampleRate) {
this.numberOfChannels = numberOfChannels;
this.sampleRate = sampleRate;
this.length = length;
this.duration = this.length / this.sampleRate;
this._channelData = [];
for (var i = 0; i < this.numberOfChannels; ++i) {
this._channelData[i] = new Float32Array(length);
}
}
|
A collection of Float32Array as AudioBus abstraction.
@param {Number} numberOfChannels Number of channels.
@param {Number} length Buffer length in samples.
@param {Number} sampleRate Operating sample rate.
|
AudioBus
|
javascript
|
GoogleChrome/omnitone
|
test/test-setup.js
|
https://github.com/GoogleChrome/omnitone/blob/master/test/test-setup.js
|
Apache-2.0
|
mockTrace = () => ({
traceAsyncFn: (fn) => fn(mockTrace()),
traceFn: (fn) => fn(mockTrace()),
traceChild: () => mockTrace(),
})
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
mockTrace
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
mockTrace = () => ({
traceAsyncFn: (fn) => fn(mockTrace()),
traceFn: (fn) => fn(mockTrace()),
traceChild: () => mockTrace(),
})
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
mockTrace
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
async function maybeLogSummary() {
if (process.env.CI && errorsPerTests.size > 0) {
const outputTemplate = `
${Array.from(errorsPerTests.entries())
.map(([test, output]) => {
return `
<details>
<summary>${test}</summary>
\`\`\`
${output}
\`\`\`
</details>
`
})
.join('\n')}`
await core.summary
.addHeading('Tests failures')
.addTable([
[
{
data: 'Test suite',
header: true,
},
],
...Array.from(errorsPerTests.entries()).map(([test]) => {
return [
`<a href="https://github.com/vercel/next.js/blob/canary/${test}">${test}</a>`,
]
}),
])
.addRaw(outputTemplate)
.write()
}
}
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
maybeLogSummary
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
cleanUpAndExit = async (code) => {
if (exiting) {
return
}
exiting = true
console.log(`exiting with code ${code}`)
if (process.env.NEXT_TEST_STARTER) {
await fsp.rm(process.env.NEXT_TEST_STARTER, {
recursive: true,
force: true,
})
}
if (process.env.NEXT_TEST_TEMP_REPO) {
await fsp.rm(process.env.NEXT_TEST_TEMP_REPO, {
recursive: true,
force: true,
})
}
if (process.env.CI) {
await maybeLogSummary()
}
process.exit(code)
}
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
cleanUpAndExit
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
cleanUpAndExit = async (code) => {
if (exiting) {
return
}
exiting = true
console.log(`exiting with code ${code}`)
if (process.env.NEXT_TEST_STARTER) {
await fsp.rm(process.env.NEXT_TEST_STARTER, {
recursive: true,
force: true,
})
}
if (process.env.NEXT_TEST_TEMP_REPO) {
await fsp.rm(process.env.NEXT_TEST_TEMP_REPO, {
recursive: true,
force: true,
})
}
if (process.env.CI) {
await maybeLogSummary()
}
process.exit(code)
}
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
cleanUpAndExit
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
isMatchingPattern = (pattern, file) => {
if (pattern instanceof RegExp) {
return pattern.test(file)
} else {
return file.startsWith(pattern)
}
}
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
isMatchingPattern
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
isMatchingPattern = (pattern, file) => {
if (pattern instanceof RegExp) {
return pattern.test(file)
} else {
return file.startsWith(pattern)
}
}
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
isMatchingPattern
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
async function getTestTimings() {
let timingsRes
const doFetch = () =>
fetch(TIMINGS_API, {
headers: {
...TIMINGS_API_HEADERS,
},
})
timingsRes = await doFetch()
if (timingsRes.status === 403) {
const delay = 15
console.log(`Got 403 response waiting ${delay} seconds before retry`)
await new Promise((resolve) => setTimeout(resolve, delay * 1000))
timingsRes = await doFetch()
}
if (!timingsRes.ok) {
throw new Error(`request status: ${timingsRes.status}`)
}
const timingsData = await timingsRes.json()
return JSON.parse(timingsData.files['test-timings.json'].content)
}
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
getTestTimings
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
doFetch = () =>
fetch(TIMINGS_API, {
headers: {
...TIMINGS_API_HEADERS,
},
})
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
doFetch
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
doFetch = () =>
fetch(TIMINGS_API, {
headers: {
...TIMINGS_API_HEADERS,
},
})
|
@typedef {{ file: string, excludedCases: string[] }} TestFile
|
doFetch
|
javascript
|
vercel/next.js
|
run-tests.js
|
https://github.com/vercel/next.js/blob/master/run-tests.js
|
MIT
|
function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os.EOL);
}
|
Commands
Command Format:
::name key=value,key=value::message
Examples:
::warning::This is the message
::set-env name=MY_VAR::some value
|
issueCommand
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function issue(name, message = '') {
issueCommand(name, {}, message);
}
|
Commands
Command Format:
::name key=value,key=value::message
Examples:
::warning::This is the message
::set-env name=MY_VAR::some value
|
issue
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
constructor(command, properties, message) {
if (!command) {
command = 'missing.command';
}
this.command = command;
this.properties = properties;
this.message = message;
}
|
Commands
Command Format:
::name key=value,key=value::message
Examples:
::warning::This is the message
::set-env name=MY_VAR::some value
|
constructor
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
toString() {
let cmdStr = CMD_STRING + this.command;
if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' ';
let first = true;
for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key];
if (val) {
if (first) {
first = false;
}
else {
cmdStr += ',';
}
cmdStr += `${key}=${escapeProperty(val)}`;
}
}
}
}
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
return cmdStr;
}
|
Commands
Command Format:
::name key=value,key=value::message
Examples:
::warning::This is the message
::set-env name=MY_VAR::some value
|
toString
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function escapeData(s) {
return (0, utils_1.toCommandValue)(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A');
}
|
Commands
Command Format:
::name key=value,key=value::message
Examples:
::warning::This is the message
::set-env name=MY_VAR::some value
|
escapeData
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function escapeProperty(s) {
return (0, utils_1.toCommandValue)(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
.replace(/:/g, '%3A')
.replace(/,/g, '%2C');
}
|
Commands
Command Format:
::name key=value,key=value::message
Examples:
::warning::This is the message
::set-env name=MY_VAR::some value
|
escapeProperty
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function exportVariable(name, val) {
const convertedVal = (0, utils_1.toCommandValue)(val);
process.env[name] = convertedVal;
const filePath = process.env['GITHUB_ENV'] || '';
if (filePath) {
return (0, file_command_1.issueFileCommand)('ENV', (0, file_command_1.prepareKeyValueMessage)(name, val));
}
(0, command_1.issueCommand)('set-env', { name }, convertedVal);
}
|
Sets env variable for this action and future actions in the job
@param name the name of the variable to set
@param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
exportVariable
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function setSecret(secret) {
(0, command_1.issueCommand)('add-mask', {}, secret);
}
|
Registers a secret which will get masked from logs
@param secret value of the secret
|
setSecret
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function addPath(inputPath) {
const filePath = process.env['GITHUB_PATH'] || '';
if (filePath) {
(0, file_command_1.issueFileCommand)('PATH', inputPath);
}
else {
(0, command_1.issueCommand)('add-path', {}, inputPath);
}
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
|
Prepends inputPath to the PATH (for this action and future actions)
@param inputPath
|
addPath
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`);
}
if (options && options.trimWhitespace === false) {
return val;
}
return val.trim();
}
|
Gets the value of an input.
Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
Returns an empty string if the value is not defined.
@param name name of the input to get
@param options optional. See InputOptions.
@returns string
|
getInput
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function getMultilineInput(name, options) {
const inputs = getInput(name, options)
.split('\n')
.filter(x => x !== '');
if (options && options.trimWhitespace === false) {
return inputs;
}
return inputs.map(input => input.trim());
}
|
Gets the values of an multiline input. Each value is also trimmed.
@param name name of the input to get
@param options optional. See InputOptions.
@returns string[]
|
getMultilineInput
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function getBooleanInput(name, options) {
const trueValue = ['true', 'True', 'TRUE'];
const falseValue = ['false', 'False', 'FALSE'];
const val = getInput(name, options);
if (trueValue.includes(val))
return true;
if (falseValue.includes(val))
return false;
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
}
|
Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
Support boolean input list: `true | True | TRUE | false | False | FALSE` .
The return value is also in boolean type.
ref: https://yaml.org/spec/1.2/spec.html#id2804923
@param name name of the input to get
@param options optional. See InputOptions.
@returns boolean
|
getBooleanInput
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function setOutput(name, value) {
const filePath = process.env['GITHUB_OUTPUT'] || '';
if (filePath) {
return (0, file_command_1.issueFileCommand)('OUTPUT', (0, file_command_1.prepareKeyValueMessage)(name, value));
}
process.stdout.write(os.EOL);
(0, command_1.issueCommand)('set-output', { name }, (0, utils_1.toCommandValue)(value));
}
|
Sets the value of an output.
@param name name of the output to set
@param value value to store. Non-string values will be converted to a string via JSON.stringify
|
setOutput
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function setCommandEcho(enabled) {
(0, command_1.issue)('echo', enabled ? 'on' : 'off');
}
|
Enables or disables the echoing of commands into stdout for the rest of the step.
Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
setCommandEcho
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function setFailed(message) {
process.exitCode = ExitCode.Failure;
error(message);
}
|
Sets the action status to failed.
When the action exits it will be with an exit code of 1
@param message add error issue message
|
setFailed
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function isDebug() {
return process.env['RUNNER_DEBUG'] === '1';
}
|
Gets whether Actions Step Debug is on or not
|
isDebug
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function debug(message) {
(0, command_1.issueCommand)('debug', {}, message);
}
|
Writes debug message to user log
@param message debug message
|
debug
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function error(message, properties = {}) {
(0, command_1.issueCommand)('error', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
}
|
Adds an error issue
@param message error issue message. Errors will be converted to string via toString()
@param properties optional properties to add to the annotation.
|
error
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function warning(message, properties = {}) {
(0, command_1.issueCommand)('warning', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
}
|
Adds a warning issue
@param message warning issue message. Errors will be converted to string via toString()
@param properties optional properties to add to the annotation.
|
warning
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function notice(message, properties = {}) {
(0, command_1.issueCommand)('notice', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
}
|
Adds a notice issue
@param message notice issue message. Errors will be converted to string via toString()
@param properties optional properties to add to the annotation.
|
notice
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function info(message) {
process.stdout.write(message + os.EOL);
}
|
Writes info to log with console.log.
@param message info message
|
info
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function startGroup(name) {
(0, command_1.issue)('group', name);
}
|
Begin an output group.
Output until the next `groupEnd` will be foldable in this group
@param name The name of the output group
|
startGroup
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function group(name, fn) {
return __awaiter(this, void 0, void 0, function* () {
startGroup(name);
let result;
try {
result = yield fn();
}
finally {
endGroup();
}
return result;
});
}
|
Wrap an asynchronous function call in a group.
Returns the same type as the function itself.
@param name The name of the group
@param fn The function to wrap in the group
|
group
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function saveState(name, value) {
const filePath = process.env['GITHUB_STATE'] || '';
if (filePath) {
return (0, file_command_1.issueFileCommand)('STATE', (0, file_command_1.prepareKeyValueMessage)(name, value));
}
(0, command_1.issueCommand)('save-state', { name }, (0, utils_1.toCommandValue)(value));
}
|
Saves state for current action, the state can only be retrieved by this action's post job execution.
@param name name of the state to store
@param value value to store. Non-string values will be converted to a string via JSON.stringify
|
saveState
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function getState(name) {
return process.env[`STATE_${name}`] || '';
}
|
Gets the value of an state set by this action's main execution.
@param name name of the state to get
@returns string
|
getState
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function getIDToken(aud) {
return __awaiter(this, void 0, void 0, function* () {
return yield oidc_utils_1.OidcClient.getIDToken(aud);
});
}
|
Gets the value of an state set by this action's main execution.
@param name name of the state to get
@returns string
|
getIDToken
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function toPosixPath(pth) {
return pth.replace(/[\\]/g, '/');
}
|
toPosixPath converts the given path to the posix form. On Windows, \\ will be
replaced with /.
@param pth. Path to transform.
@return string Posix path.
|
toPosixPath
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function toWin32Path(pth) {
return pth.replace(/[/]/g, '\\');
}
|
toWin32Path converts the given path to the win32 form. On Linux, / will be
replaced with \\.
@param pth. Path to transform.
@return string Win32 path.
|
toWin32Path
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function toPlatformPath(pth) {
return pth.replace(/[/\\]/g, path.sep);
}
|
toPlatformPath converts the given path to a platform-specific path. It does
this by replacing instances of / and \ with the platform-specific path
separator.
@param pth The path to platformize.
@return string The platform-specific path.
|
toPlatformPath
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
filePath() {
return __awaiter(this, void 0, void 0, function* () {
if (this._filePath) {
return this._filePath;
}
const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
if (!pathFromEnv) {
throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
}
try {
yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
}
catch (_a) {
throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
}
this._filePath = pathFromEnv;
return this._filePath;
});
}
|
Finds the summary file path from the environment, rejects if env var is not found or file does not exist
Also checks r/w permissions.
@returns step summary file path
|
filePath
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
wrap(tag, content, attrs = {}) {
const htmlAttrs = Object.entries(attrs)
.map(([key, value]) => ` ${key}="${value}"`)
.join('');
if (!content) {
return `<${tag}${htmlAttrs}>`;
}
return `<${tag}${htmlAttrs}>${content}</${tag}>`;
}
|
Wraps content in an HTML tag, adding any HTML attributes
@param {string} tag HTML tag to wrap
@param {string | null} content content within the tag
@param {[attribute: string]: string} attrs key-value list of HTML attributes to add
@returns {string} content wrapped in HTML element
|
wrap
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
write(options) {
return __awaiter(this, void 0, void 0, function* () {
const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
const filePath = yield this.filePath();
const writeFunc = overwrite ? writeFile : appendFile;
yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
return this.emptyBuffer();
});
}
|
Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
@param {SummaryWriteOptions} [options] (optional) options for write operation
@returns {Promise<Summary>} summary instance
|
write
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
clear() {
return __awaiter(this, void 0, void 0, function* () {
return this.emptyBuffer().write({ overwrite: true });
});
}
|
Clears the summary buffer and wipes the summary file
@returns {Summary} summary instance
|
clear
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
stringify() {
return this._buffer;
}
|
Returns the current summary buffer as a string
@returns {string} string of summary buffer
|
stringify
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
isEmptyBuffer() {
return this._buffer.length === 0;
}
|
If the summary buffer is empty
@returns {boolen} true if the buffer is empty
|
isEmptyBuffer
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
emptyBuffer() {
this._buffer = '';
return this;
}
|
Resets the summary buffer without writing to summary file
@returns {Summary} summary instance
|
emptyBuffer
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addRaw(text, addEOL = false) {
this._buffer += text;
return addEOL ? this.addEOL() : this;
}
|
Adds raw text to the summary buffer
@param {string} text content to add
@param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
@returns {Summary} summary instance
|
addRaw
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addEOL() {
return this.addRaw(os_1.EOL);
}
|
Adds the operating system-specific end-of-line marker to the buffer
@returns {Summary} summary instance
|
addEOL
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addCodeBlock(code, lang) {
const attrs = Object.assign({}, (lang && { lang }));
const element = this.wrap('pre', this.wrap('code', code), attrs);
return this.addRaw(element).addEOL();
}
|
Adds an HTML codeblock to the summary buffer
@param {string} code content to render within fenced code block
@param {string} lang (optional) language to syntax highlight code
@returns {Summary} summary instance
|
addCodeBlock
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addList(items, ordered = false) {
const tag = ordered ? 'ol' : 'ul';
const listItems = items.map(item => this.wrap('li', item)).join('');
const element = this.wrap(tag, listItems);
return this.addRaw(element).addEOL();
}
|
Adds an HTML list to the summary buffer
@param {string[]} items list of items to render
@param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
@returns {Summary} summary instance
|
addList
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addTable(rows) {
const tableBody = rows
.map(row => {
const cells = row
.map(cell => {
if (typeof cell === 'string') {
return this.wrap('td', cell);
}
const { header, data, colspan, rowspan } = cell;
const tag = header ? 'th' : 'td';
const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
return this.wrap(tag, data, attrs);
})
.join('');
return this.wrap('tr', cells);
})
.join('');
const element = this.wrap('table', tableBody);
return this.addRaw(element).addEOL();
}
|
Adds an HTML table to the summary buffer
@param {SummaryTableCell[]} rows table rows
@returns {Summary} summary instance
|
addTable
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addDetails(label, content) {
const element = this.wrap('details', this.wrap('summary', label) + content);
return this.addRaw(element).addEOL();
}
|
Adds a collapsable HTML details element to the summary buffer
@param {string} label text for the closed state
@param {string} content collapsable content
@returns {Summary} summary instance
|
addDetails
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addImage(src, alt, options) {
const { width, height } = options || {};
const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
return this.addRaw(element).addEOL();
}
|
Adds an HTML image tag to the summary buffer
@param {string} src path to the image you to embed
@param {string} alt text description of the image
@param {SummaryImageOptions} options (optional) addition image attributes
@returns {Summary} summary instance
|
addImage
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addHeading(text, level) {
const tag = `h${level}`;
const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
? tag
: 'h1';
const element = this.wrap(allowedTag, text);
return this.addRaw(element).addEOL();
}
|
Adds an HTML section heading element
@param {string} text heading text
@param {number | string} [level=1] (optional) the heading level, default: 1
@returns {Summary} summary instance
|
addHeading
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addSeparator() {
const element = this.wrap('hr', null);
return this.addRaw(element).addEOL();
}
|
Adds an HTML thematic break (<hr>) to the summary buffer
@returns {Summary} summary instance
|
addSeparator
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addBreak() {
const element = this.wrap('br', null);
return this.addRaw(element).addEOL();
}
|
Adds an HTML line break (<br>) to the summary buffer
@returns {Summary} summary instance
|
addBreak
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addQuote(text, cite) {
const attrs = Object.assign({}, (cite && { cite }));
const element = this.wrap('blockquote', text, attrs);
return this.addRaw(element).addEOL();
}
|
Adds an HTML blockquote to the summary buffer
@param {string} text quote text
@param {string} cite (optional) citation url
@returns {Summary} summary instance
|
addQuote
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
addLink(text, href) {
const element = this.wrap('a', text, { href });
return this.addRaw(element).addEOL();
}
|
Adds an HTML anchor tag to the summary buffer
@param {string} text link text/content
@param {string} href hyperlink
@returns {Summary} summary instance
|
addLink
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
function toCommandValue(input) {
if (input === null || input === undefined) {
return '';
}
else if (typeof input === 'string' || input instanceof String) {
return input;
}
return JSON.stringify(input);
}
|
Sanitizes an input into a string so it can be passed into issueCommand safely
@param input input to sanitize into a string
|
toCommandValue
|
javascript
|
vercel/next.js
|
.github/actions/next-integration-stat/dist/index.js
|
https://github.com/vercel/next.js/blob/master/.github/actions/next-integration-stat/dist/index.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.