David Brockman Smoliansky dbrockman

View function-proxy.js
1 2 3 4 5 6 7 8 9 10
exports.proxy = function(length, fn) {
return createProxyFactory(length)(fn);
}
 
function createProxyFactory(length) {
return Function(
'var fn = arguments[0];' +
'return function(' + argNames(length) + '){' +
' return fn.apply(this, arguments);' +
'}'
View deprecate-property.js
1 2 3 4 5 6 7 8
function deprecate(obj, prop) {
Object.defineProperty(obj, prop, {
enumerable: true,
get: function() {
throw new Error('Property ' + prop + ' is deprecated!');
}
});
}
View StringBuilder.js
1 2 3 4 5 6 7 8 9 10
/* @flow */
 
export class StringBuilder {
encoding: string;
byte_length: number;
list: Array<Buffer>;
 
constructor(encoding?: string = 'utf8') {
this.encoding = encoding;
this.byte_length = 0;
View modulo.js
1 2 3 4 5 6 7 8
function modulo(a, b) {
var r = a % b;
return (r * b < 0) ? r + b : r;
}
 
function nthArrayItem(array, n) {
return array[modulo(n, array.length)];
}
View index.js
1 2 3 4 5 6 7 8 9
var joi = require('joi');
var joi_to_markdown = require('joi-to-markdown');
var event_util = require('dom-events');
var insertCSS = require('insert-css');
 
var container = document.createElement('div');
var input_textarea = document.createElement('textarea');
var convert_button = document.createElement('button');
var output = document.createElement('pre');
View async-dust-helper.js
1 2 3 4 5 6 7 8
dust.helpers.getValueAsync = function(chunk, context, bodies, params) {
return chunk.map(function(inner_chunk) {
// Simulate an async op with setImmediate
setImmediate(function() {
inner_chunk.write('It works!').end();
});
});
};
View node-test-alias.sh
1 2 3
alias t='NODE_ENV=test ./node_modules/.bin/istanbul cover --report lcov ./node_modules/.bin/_mocha -- --ui bdd --check-leaks --recursive --slow 200 --reporter dot test'
alias tm='NODE_ENV=test ./node_modules/.bin/mocha --bail --ui bdd --check-leaks --recursive --slow 200 --reporter dot test'
alias tc='NODE_ENV=test ./node_modules/.bin/mocha --bail --ui bdd --check-leaks --reporter dot $(git diff --name-only test | grep -E "(\.js)$")'
View breadcrumb-trail.js
1
console.log('BREADCRUMB TRAIL', new Error().stack.split('\n')[1].trim());
View flatten-array.js
1 2 3 4 5 6 7 8 9 10
function flatten(arr) {
var result = [], i, len, val;
if (arr) {
for (i = 0, len = arr.length; i < len; ++i) {
val = arr[i];
if (Array.isArray(val)) {
result.push.apply(result, flatten(val));
}
else {
result.push(val);
View object-utils.js
1 2 3 4 5 6 7 8 9 10
function merge() {
var dst = {}, src, keys, i = 0, j;
for (; i < arguments.length; i++) {
src = arguments[i];
keys = Object.keys(src);
for (j = 0; j < keys.length; j++) {
dst[keys[j]] = src[keys[j]];
}
}
return dst;
Something went wrong with that request. Please try again.