sha256 stringlengths 64 64 | language stringclasses 25
values | size int32 1 210k | lines int32 1 9.41k | content stringlengths 1 200k |
|---|---|---|---|---|
a4f55c88f834e1a19cb4a0b6d61a8a1370a124debbc44a8bfda399f08bbe4a4b | JavaScript | 268 | 9 | 'use strict';
const path = require('path');
const fs = require('fs');
const hasYarn = (cwd = process.cwd()) => fs.existsSync(path.resolve(cwd, 'yarn.lock'));
module.exports = hasYarn;
// TODO: Remove this for the next major release
module.exports.default = hasYarn;
|
733f287bde0281daa16a3ee8e006266c37d7aa81a5750c2e2379535fea265977 | JavaScript | 274 | 11 | 'use strict'
var EventEmitter = require('events').EventEmitter
var util = require('util')
var trackerId = 0
var TrackerBase = module.exports = function (name) {
EventEmitter.call(this)
this.id = ++trackerId
this.name = name
}
util.inherits(TrackerBase, EventEmitter)
|
7c95f89c5f563badae35326ebbd548078fdaff3b5f0283bd6e1cca84fff08db4 | JavaScript | 276 | 12 | 'use strict';
const is = require('@sindresorhus/is');
module.exports = function deepFreeze(object) {
for (const [key, value] of Object.entries(object)) {
if (is.plainObject(value) || is.array(value)) {
deepFreeze(object[key]);
}
}
return Object.freeze(object);
};
|
febfd74bf58ea45f7a95f57b563d53027d84b454008f048db9a43b1b5ec5d864 | JavaScript | 279 | 15 | getJasmineRequireObj().Falsy = function(j$, private$) {
'use strict';
function Falsy() {}
Falsy.prototype.asymmetricMatch = function(other) {
return !other;
};
Falsy.prototype.jasmineToString = function() {
return '<jasmine.falsy>';
};
return Falsy;
};
|
58c4d9696cf000428c499dbb516499fe0558104b67a61fc947ed1a45065d18ce | JavaScript | 282 | 13 | const spawn = require('child_process').spawn;
function run() {
spawn(
'sh',
['-c', 'node -e "setInterval(() => console.log(`running`), 200)"'],
{
stdio: 'pipe',
}
);
}
var runCallCount = process.argv[2] || 1;
for (var i = 0; i < runCallCount; i++) run();
|
a4b1fff0e05d5a8d5ad0d0494b9eb7f539e27c4b9c6d6ba3951ebee331fa1022 | JavaScript | 282 | 7 | describe('NullDiffBuilder', function() {
it('responds to withPath() by calling the passed function', function() {
const spy = jasmine.createSpy('callback');
privateUnderTest.NullDiffBuilder().withPath('does not matter', spy);
expect(spy).toHaveBeenCalled();
});
});
|
dcab9f772274dd761ec1bff8ffb8372850f0586b2695df3ceb6280fff702c4a5 | JavaScript | 285 | 15 | const SerialPort = require('@serialport/stream')
const Binding = require('@serialport/bindings')
const parsers = require('./parsers')
/**
* @type {AbstractBinding}
*/
SerialPort.Binding = Binding
/**
* @type {Parsers}
*/
SerialPort.parsers = parsers
module.exports = SerialPort
|
7303ba9f89a8bd7e215153a911d916852e87458ee07e0dd97ab220c6ff2f0832 | JavaScript | 286 | 15 | getJasmineRequireObj().Truthy = function(j$, private$) {
'use strict';
function Truthy() {}
Truthy.prototype.asymmetricMatch = function(other) {
return !!other;
};
Truthy.prototype.jasmineToString = function() {
return '<jasmine.truthy>';
};
return Truthy;
};
|
2c24a892f6eb33cac61f2674697c35f83c8f2c51d242740f5aad4bf1ce4c8f5d | JavaScript | 287 | 13 | 'use strict';
const semver = require('semver');
module.exports = (versionA, versionB) => {
versionA = semver.parse(versionA);
versionB = semver.parse(versionB);
if (semver.compareBuild(versionA, versionB) >= 0) {
return;
}
return semver.diff(versionA, versionB) || 'build';
};
|
921ba24f2aa18494f12c19e48ee6f9713d5ec158c86cd529bac26cb18d26f6e5 | JavaScript | 292 | 12 | 'use strict'
module.exports = isWin32() || isColorTerm()
function isWin32 () {
return process.platform === 'win32'
}
function isColorTerm () {
var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i
return !!process.env.COLORTERM || termHasColor.test(process.env.TERM)
}
|
c2b0c9905540a51acb276523bb024ef3c11bd118b03a90d92962080ebd07fec9 | JavaScript | 296 | 10 | 'use strict';
const WebSocket = require('./lib/websocket');
WebSocket.createWebSocketStream = require('./lib/stream');
WebSocket.Server = require('./lib/websocket-server');
WebSocket.Receiver = require('./lib/receiver');
WebSocket.Sender = require('./lib/sender');
module.exports = WebSocket;
|
351e098df10b45412253ff0ed0984fad6a615dd24d3c245176d057bba2f3ecdc | JavaScript | 309 | 9 | 'use strict';
const userAgent = process.env.npm_config_user_agent;
const isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
const isNpm = Boolean(userAgent && userAgent.startsWith('npm'));
module.exports.isNpmOrYarn = isNpm || isYarn;
module.exports.isNpm = isNpm;
module.exports.isYarn = isYarn;
|
f83a601bb6f1ebe31089c0de9e12cdefa11dd57694412d5d6c7df79f6063e787 | JavaScript | 309 | 13 | getJasmineRequireObj().formatErrorMsg = function() {
'use strict';
function generateErrorMsg(domain, usage) {
const usageDefinition = usage ? '\nUsage: ' + usage : '';
return function errorMsg(msg) {
return domain + ' : ' + msg + usageDefinition;
};
}
return generateErrorMsg;
};
|
ffc0a3870bf65102fffc505de80cba36b7a08d5b85fb77bc63328ab55efa7942 | JavaScript | 309 | 12 | 'use strict';
const path = require('path');
module.exports = function () {
const isWindows = process.platform === 'win32';
const yarnPath = isWindows ? path.join('Yarn', 'config', 'global') : path.join('.config', 'yarn', 'global');
if (__dirname.includes(yarnPath)) {
return true;
}
return false;
};
|
de40b4f5d4f8d7dfeeaae96d767c512e3cc3a4bfeee8780e608306ac36284a6d | JavaScript | 312 | 16 | var cc =require('../lib/utils')
var INI = require('ini')
var assert = require('assert')
function test(obj) {
var _json, _ini
var json = cc.parse (_json = JSON.stringify(obj))
var ini = cc.parse (_ini = INI.stringify(obj))
console.log(_ini, _json)
assert.deepEqual(json, ini)
}
test({hello: true})
|
e803f8aa84081d8d072bb2ba172a4f48e9cecbbbfd56e378d786ee4a66868d7e | JavaScript | 312 | 13 | getJasmineRequireObj().NeverSkipPolicy = function(j$, private$) {
'use strict';
function NeverSkipPolicy(queueableFns) {}
NeverSkipPolicy.prototype.skipTo = function(lastRanFnIx) {
return lastRanFnIx + 1;
};
NeverSkipPolicy.prototype.fnErrored = function(fnIx) {};
return NeverSkipPolicy;
};
|
aa127ff1752b7d9c7415c5c7bb6994d9aa722b81bcbcab4bd48316b013d23bf3 | JavaScript | 314 | 10 | /**
* Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser.
*/
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');
}
|
68c194a1ed4d3dd61680cc1990aaefb0b2ff81308670a04b7e103b637ae0e1b3 | JavaScript | 317 | 10 | 'use strict';
module.exports = ({onlyFirst = false} = {}) => {
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
].join('|');
return new RegExp(pattern, onlyFirst ? undefined : 'g');
};
|
46997dc4554dd5a554b4883a9c13180c628bb36baadf8f89d2db5861f5239f44 | JavaScript | 320 | 20 | var isArray = require('./');
var test = require('tape');
test('is array', function(t){
t.ok(isArray([]));
t.notOk(isArray({}));
t.notOk(isArray(null));
t.notOk(isArray(false));
var obj = {};
obj[0] = true;
t.notOk(isArray(obj));
var arr = [];
arr.foo = 'bar';
t.ok(isArray(arr));
t.end();
});
|
dc0f89bdb136779f9ec062e0a2963a3ec89f45731eec9e8028907ae9f9e9034d | JavaScript | 320 | 8 | 'use strict';
module.exports = (flag, argv) => {
argv = argv || process.argv;
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const pos = argv.indexOf(prefix + flag);
const terminatorPos = argv.indexOf('--');
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
};
|
1a78922b73d37289e4a25b88f7a145956d15281e46a546a05c9f6d5df257f83e | JavaScript | 322 | 15 | beforeEach(function () {
jasmine.addMatchers({
toBePlaying: function () {
return {
compare: function (actual, expected) {
const player = actual;
return {
pass: player.currentlyPlayingSong === expected && player.isPlaying
};
}
};
}
});
})... |
bce0a85d7a3b61a8246cca2fed01df1cea903c2fdd1e197a4ff170404610f37e | JavaScript | 322 | 16 | 'use strict';
const stringWidth = require('string-width');
const widestLine = input => {
let max = 0;
for (const line of input.split('\n')) {
max = Math.max(max, stringWidth(line));
}
return max;
};
module.exports = widestLine;
// TODO: remove this in the next major version
module.exports.default = widestLine... |
de67807817d57570f5b4a39e165f724903240d430e1bd8c52598f433dff81566 | JavaScript | 323 | 13 | const DOCUMENTATION_OPTIONS = {
VERSION: '',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
LINK_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false,
SHOW_SEARCH_SUMMARY: true,
ENABLE_SEARCH_SHORTCUTS: true,... |
f6d27329414c8780cdf77486ccd64982778c786dc89b6c040a5f90da5532fffd | JavaScript | 325 | 10 | document$.subscribe(({ body }) => {
renderMathInElement(body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true }
],
})... |
7a1095012811a80eaaa8d6e789abdc5738d52cd5680952d7d7085288168f1c0c | JavaScript | 328 | 15 | var parse = require('../');
var test = require('tape');
test('stops parsing on the first non-option when stopEarly is set', function (t) {
var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], {
stopEarly: true
});
t.deepEqual(argv, {
aaa: 'bbb',
_: ['ccc', '--ddd']
});
t.end... |
7fdaa2c91ca8cefa5726d5d09bcb109c5ccb71adcf107588e1a4cf548d199780 | JavaScript | 328 | 15 | getJasmineRequireObj().Anything = function(j$, private$) {
'use strict';
function Anything() {}
Anything.prototype.asymmetricMatch = function(other) {
return other !== undefined && other !== null;
};
Anything.prototype.jasmineToString = function() {
return '<jasmine.anything>';
};
return Anyth... |
c9eea350b080591e85bb02077cd1e4d9f90333ebf016b90ee6888ad28a8f88c5 | JavaScript | 328 | 13 | const DOCUMENTATION_OPTIONS = {
VERSION: '3.7.1',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
LINK_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false,
SHOW_SEARCH_SUMMARY: true,
ENABLE_SEARCH_SHORTCUTS: ... |
e9e921d4734fee9405bef5886c010c80a8f10fe958e5d71bd5d8eed5e616e78d | JavaScript | 330 | 8 | 'use strict';
module.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosi... |
49c2426f5032902827c51781dbbedfa5d77c0934d785e3125efde53b5238eaaa | JavaScript | 331 | 12 | "use strict";
/**
* Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser.
*/
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = require('./browser.js');
} else {
module.exports = require('./nod... |
3eff3bf41d1286c85e63e8ffd14e5a66eba9e92a3cbe40f45e37df3a8cbebdc2 | JavaScript | 333 | 19 | getJasmineRequireObj().Is = function(j$, private$) {
'use strict';
class Is {
constructor(expected) {
this.expected_ = expected;
}
asymmetricMatch(actual) {
return actual === this.expected_;
}
jasmineToString(pp) {
return `<jasmine.is(${pp(this.expected_)})>`;
}
}
r... |
ded72e0890a4d2aea0636762197b0abcb4bb17e6c99531913e6437c175b2fcd6 | JavaScript | 334 | 11 | 'use strict';
const packageJson = require('package-json');
const lastestVersion = async (packageName, options) => {
const {version} = await packageJson(packageName.toLowerCase(), options);
return version;
};
module.exports = lastestVersion;
// TODO: Remove this for the next major release
module.exports.default = la... |
ad235c3cd185fc17b321c6f3f30eb07ff2f3445eb6ba40d2df230d082b0f0d1c | JavaScript | 335 | 17 | getJasmineRequireObj().UserContext = function(j$, private$) {
'use strict';
function UserContext() {}
UserContext.fromExisting = function(oldContext) {
const context = new UserContext();
for (const [k, v] of Object.entries(oldContext)) {
context[k] = v;
}
return context;
};
return U... |
5dc8bef6d7641158ccd485fece7fcf46566fe95b42e40a48ded7ea43366f0968 | JavaScript | 338 | 22 | /*!
* depd
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
module.exports = eventListenerCount
/**
* Get the count of listeners on an event emitter of a specific type.
*/
function eventListenerCount (emitter, type) {
return emitter.listene... |
091b65d778337599d0140b35d53c038603d1732d27c33bfe39e03871a96926b2 | JavaScript | 345 | 13 | module.exports = function (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
var x = fn(xs[i], i);
if (isArray(x)) res.push.apply(res, x);
else res.push(x);
}
return res;
};
var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) ... |
0d5136c5acac9ea60062a933894045364cf88b2f6893d4bfdacf783ea7670648 | JavaScript | 346 | 15 | 'use strict';
const fs = require('fs');
const globalDirs = require('global-dirs');
const isPathInside = require('is-path-inside');
module.exports = (() => {
try {
return (
isPathInside(__dirname, globalDirs.yarn.packages) ||
isPathInside(__dirname, fs.realpathSync(globalDirs.npm.packages))
);
} catch (_) {... |
b8cfca7fb10e04c8a97029ae4076f2b9b424c9c95e4960c24bcf9cdd67af156d | JavaScript | 347 | 8 | /*global jQuery:false*/
'use strict';
/* Puts the included jQuery into our own namespace using noConflict and passing
* it 'true'. This ensures that the included jQuery doesn't pollute the global
* namespace (i.e. this preserves pre-existing values for both window.$ and
* window.jQuery).
*/
window.django = {jQuery:... |
ec8e6f4e484d5269bc134752e11770b66b6be3a470217c2a0166e977965f53c6 | JavaScript | 351 | 7 | exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = exports;
exports.Readable = exports;
exports.Writable = require('./lib/_stream_writable.js');
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('.... |
0df3fa571a7fb2563113d8a7ea83c79e769830abbe7b5d5d9cd430c3ea893f68 | JavaScript | 355 | 14 | exports.noPrebuilts = function (opts) {
return new Error([
'No prebuilt binaries found',
'(target=' + opts.target,
'runtime=' + opts.runtime,
'arch=' + opts.arch,
'libc=' + opts.libc,
'platform=' + opts.platform + ')'
].join(' '))
}
exports.invalidArchive = function () {
return new Error(... |
81e1042644c536b81eb757706b8f745e28dfb475ea28f05f26b9d4077d83f39a | JavaScript | 357 | 22 | class Player {
play(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
}
pause() {
this.isPlaying = false;
}
resume() {
if (this.isPlaying) {
throw new Error('song is already playing');
}
this.isPlaying = true;
}
makeFavorite() {
this.currentlyPlayingSon... |
b03490694d3582453bf41972298bd018f39886a72d895db6d5f98ee057462c62 | JavaScript | 367 | 14 | 'use strict';
module.exports = options => {
options = Object.assign({
onlyFirst: false
}, options);
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
].join('|');
return new RegExp(pat... |
900eeff5c12860d9c1ad9240f17522434bcc2a60c30b309d666b5a010bea95ac | JavaScript | 369 | 23 | getJasmineRequireObj().nothing = function() {
'use strict';
/**
* {@link expect} nothing explicitly.
* @function
* @name matchers#nothing
* @since 2.8.0
* @example
* expect().nothing();
*/
function nothing() {
return {
compare: function() {
return {
pass: true
... |
08c242a5ff86e63801840b6cd6524102f9d044c83369e5245f140bc9994622e9 | JavaScript | 371 | 11 | const tar = require('tar-stream')
const fs = require('fs')
const path = require('path')
const pipeline = require('pump') // eequire('stream').pipeline
fs.createReadStream('test.tar')
.pipe(tar.extract())
.on('entry', function (header, stream, done) {
console.log(header.name)
pipeline(stream, fs.createWrite... |
99a4f0b6ebe4b213e904a3563973da0b98caba8b7f2877fbbe5084aeadeeb307 | JavaScript | 371 | 18 | #!/usr/bin/env node
'use strict';
var spawnSync = require('child_process').spawnSync;
var libc = require('../');
var spawnOptions = {
env: process.env,
shell: true,
stdio: 'inherit'
};
if (libc.isNonGlibcLinux) {
spawnOptions.env.LIBC = process.env.LIBC || libc.family;
}
process.exit(spawnSync(process.argv... |
949ae67ec1b655694f83dce57d47d9d77234f9e7d698616932a90e69c7afee91 | JavaScript | 373 | 15 | module.exports = inspectorLog;
// black hole
const nullStream = new (require('stream').Writable)();
nullStream._write = () => {};
/**
* Outputs a `console.log()` to the Node.js Inspector console *only*.
*/
function inspectorLog() {
const stdout = console._stdout;
console._stdout = nullStream;
console.log.appl... |
3133452340213b51f7989219f148bdc724d930af229206be721437059626994d | JavaScript | 374 | 11 | const path = require('path');
const jasmineBrowser = require('jasmine-browser-runner');
const jasmineCore = require('../../lib/jasmine-core.js');
const configFile = process.argv[2] || 'jasmine-browser.js';
const config = require(path.resolve('spec/support', configFile));
config.jasmineCore = jasmineCore;
config.batch... |
a1712039aa76f42c0bf5da9b0b3cc4080fc3da8b7366ad6f456d2348d1f55769 | JavaScript | 375 | 15 | const debug = require('debug')('serialport/bindings')
switch (process.platform) {
case 'win32':
debug('loading WindowsBinding')
module.exports = require('./win32')
break
case 'darwin':
debug('loading DarwinBinding')
module.exports = require('./darwin')
break
default:
debug('loading Li... |
2b12ac6c35b76cf97296d801103cda7167649e63ef3fbff1b84d48db8b8c2a37 | JavaScript | 376 | 12 | 'use strict';
const url = require('url');
const prependHttp = require('prepend-http');
module.exports = (input, options) => {
if (typeof input !== 'string') {
throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof input}\` instead.`);
}
const finalUrl = prependHttp(input, Object.assign({h... |
4032b7f71ed9028e415ec1d38a14f6798453876e2f1e31a031724de335a7fcfa | JavaScript | 376 | 16 | var parse = require('../');
var test = require('tape');
test('short -k=v' , function (t) {
t.plan(1);
var argv = parse([ '-b=123' ]);
t.deepEqual(argv, { b: 123, _: [] });
});
test('multi short -k=v' , function (t) {
t.plan(1);
var argv = parse([ '-a=whatever', '-b=robots' ]);
t.deep... |
ec62860d6445addffd574f640451ea92e0558b6df793b2e0f1c7175fc2ff6366 | JavaScript | 381 | 23 | /**
* Merge object b with object a.
*
* var a = { foo: 'bar' }
* , b = { bar: 'baz' };
*
* merge(a, b);
* // => { foo: 'bar', bar: 'baz' }
*
* @param {Object} a
* @param {Object} b
* @return {Object}
* @api public
*/
exports = module.exports = function(a, b){
if (a && b) {
for (var... |
944694da1fed881f59c0a8e7edae0c3d28eb0ae97a886f6719c35212db531b2e | JavaScript | 383 | 24 | class Player {
play(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
}
pause() {
this.isPlaying = false;
}
resume() {
if (this.isPlaying) {
throw new Error('song is already playing');
}
this.isPlaying = true;
}
makeFavorite() {
this.currentlyPlayingSon... |
506fd344b11cf7c95da86e1471d7396a7d4f4e329ed1e530e0a5182822d18ea9 | JavaScript | 384 | 12 | // !preview r2d3 data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20)
// r2d3: https://rstudio.github.io/r2d3
var barHeight = Math.ceil(height / data.length);
svg.selectAll('rect')
.data(data)
.enter().append('rect')
.attr('width', function(d) { return d * width; })
.attr('height', barHeight)
.attr('y', function(d... |
62193f6768a098bc245f88a86a955d50643f68537d181945f6eec5792e4a294b | JavaScript | 384 | 17 | 'use strict'
/* eslint no-proto: 0 */
module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties)
function setProtoOf (obj, proto) {
obj.__proto__ = proto
return obj
}
function mixinProperties (obj, proto) {
for (var prop in proto) {
if (!obj.hasOwnProperty(... |
5c945bb599d3b3066ce73c37bba8b7f7b02d0aecaa2775562a65144255d4698d | JavaScript | 386 | 14 | //@Context context
//@UIService uiservice
importClass(Packages.bar.Runner)
var runner = new Runner(context)
runner.installIJ1Macro("tools/InsertMagnifiedROI.ijm", true)
if (!runner.scriptLoaded()) {
uiservice.showDialog("File could not be installed. See Console for details.")
}
//Uncomment next line to have the ma... |
684fa9c4f5ccd39de740e404fec3466fd84b666efed6a09307cd11b54bc3db85 | JavaScript | 387 | 15 | 'use strict';
module.exports = (url, opts) => {
if (typeof url !== 'string') {
throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof url}\``);
}
url = url.trim();
opts = Object.assign({https: false}, opts);
if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
return url;
}
return url.repl... |
c939a7960742f489b369842f8934e8d14279bc44fde149efb8b0b6bef6ab3c69 | JavaScript | 387 | 14 | // !preview r2d3 data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20)
//
// r2d3: https://rstudio.github.io/r2d3
//
var barHeight = Math.ceil(height / data.length);
svg.selectAll('rect')
.data(data)
.enter().append('rect')
.attr('width', function(d) { return d * width; })
.attr('height', barHeight)
.attr('y', func... |
fa46703aec014a01b57df0e0d3d42ff4d773cccc58e5fabd292ac61b25f731f6 | JavaScript | 387 | 18 | 'use strict';
var replace = String.prototype.replace;
var percentTwenties = /%20/g;
module.exports = {
'default': 'RFC3986',
formatters: {
RFC1738: function (value) {
return replace.call(value, percentTwenties, '+');
},
RFC3986: function (value) {
return value;
... |
2c0c7c36a2804e78de019e7e1f5b4d56e1827c3e49b0874428266456a036c67a | JavaScript | 389 | 16 | (function() {
function browserVersion(matchFn) {
const userAgent = jasmine.getGlobal().navigator.userAgent;
if (!userAgent) {
return void 0;
}
const match = matchFn(userAgent);
return match ? parseFloat(match[1]) : void 0;
}
specHelpers.firefoxVersion = browserVersion(function(userAge... |
fbd2a589ece8138da87d9a5e3d537afbbc32f08582bec0939cd3c494002259a4 | JavaScript | 392 | 15 | /*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
module.exports = function (stream, cb) {
var chunks = []
stream.on('data', function (chunk) {
chunks.push(chunk)
})
stream.once('end', function () {
if (cb) cb(null, Buffer.concat(chunks))
cb = null
})
stream.... |
3d061effea577e0ad07e248f43b8c2d074f83e00265175163c2ba3b6ac95e6fa | JavaScript | 394 | 9 | module.exports = {
ByteLength: require('@serialport/parser-byte-length'),
CCTalk: require('@serialport/parser-cctalk'),
Delimiter: require('@serialport/parser-delimiter'),
InterByteTimeout: require('@serialport/parser-inter-byte-timeout'),
Readline: require('@serialport/parser-readline'),
Ready: require('@s... |
ad22f4a05d105265611188e123e4a7ee07be6d28dc5ef39c98b4f686e7a902a7 | JavaScript | 395 | 14 | 'use strict'
var spin = require('./spin.js')
var progressBar = require('./progress-bar.js')
module.exports = {
activityIndicator: function (values, theme, width) {
if (values.spun == null) return
return spin(theme, values.spun)
},
progressbar: function (values, theme, width) {
if (values.completed ==... |
37b53a5f86384e9032a20eff3e7a8bbc2b15ffe075bf704c560c81162a371daf | JavaScript | 397 | 23 | var port = require('../port');
port({
'read': 8205, // [netsend]
'write': 8206, // [netreceive]
'encoding': 'ascii',
'basepath': __dirname,
'flags': {
'noprefs': true,
'nogui': true,
'open': 'io-netsend.pd'
}
})
.on('connect', function(){
this.write('bang;\n');
})
// receive data from [netsend]
.on('data'... |
eebeac1f3551219ac47123ae025e63a988d4f10eb911b071836c0e27360203f2 | JavaScript | 398 | 12 | 'use strict';
const rc = require('rc');
const registryUrl = scope => {
const result = rc('npm', {registry: 'https://registry.npmjs.org/'});
const url = result[`${scope}:registry`] || result.config_registry || result.registry;
return url.slice(-1) === '/' ? url : `${url}/`;
};
module.exports = registryUrl;
// TODO:... |
4e6086dcabe41ca7a48de3c053e0d97eb7f67b92bee566534417b64bbc756499 | JavaScript | 401 | 17 | 'use strict';
const PassThrough = require('stream').PassThrough;
const mimicResponse = require('mimic-response');
const cloneResponse = response => {
if (!(response && response.pipe)) {
throw new TypeError('Parameter `response` must be a response stream.');
}
const clone = new PassThrough();
mimicResponse(resp... |
d61107cea096d1fe1219cb9838b8bbddd622c291f7b32ba104a006c9d4eb817f | JavaScript | 401 | 19 | 'use strict'
module.exports = clone
function clone (obj) {
if (obj === null || typeof obj !== 'object')
return obj
if (obj instanceof Object)
var copy = { __proto__: obj.__proto__ }
else
var copy = Object.create(null)
Object.getOwnPropertyNames(obj).forEach(function (key) {
Object.defineProp... |
308d9fa4954b7014b44d3cfa2f81ca06359239eb16cd834f53efa26e0da55222 | JavaScript | 402 | 13 | describe('toBeTrue', function() {
it('passes for true', function() {
const matcher = privateUnderTest.matchers.toBeTrue();
const result = matcher.compare(true);
expect(result.pass).toBe(true);
});
it('fails for non-true', function() {
const matcher = privateUnderTest.matchers.toBeTrue();
cons... |
c73b07d2fbeba2654bb6c830e652db97efbedd4a2b7de57288fba6f6b5992ec3 | JavaScript | 402 | 13 | describe('toBeNull', function() {
it('passes for null', function() {
const matcher = privateUnderTest.matchers.toBeNull();
const result = matcher.compare(null);
expect(result.pass).toBe(true);
});
it('fails for non-null', function() {
const matcher = privateUnderTest.matchers.toBeNull();
cons... |
036b1f6f7ff7f0a36a8390e466a6d04e0484ff048d553281a9a0f8eea570e895 | JavaScript | 403 | 23 | getJasmineRequireObj().toBeFalsy = function() {
'use strict';
/**
* {@link expect} the actual value to be falsy
* @function
* @name matchers#toBeFalsy
* @since 2.0.0
* @example
* expect(result).toBeFalsy();
*/
function toBeFalsy() {
return {
compare: function(actual) {
retu... |
b0ff829d7fd3310f3fa12a28f91d14d20cd1492758c0ee6db0ab3f068bff5806 | JavaScript | 406 | 17 | module.exports = function (pkg) {
var m;
if (m = match(JSON.stringify(pkg.repository))) {
return m;
}
else if (m = match(JSON.stringify(pkg))) {
return m;
}
return undefined;
};
function match (str) {
var m = /\bgithub.com[:\/]([^\/"]+)\/([^\/"]+)/.exec(str);
if (m) {
... |
c804552490993547bbb410ce4ba16f715960794617066a35e2ca1e64bbcfd19a | JavaScript | 408 | 23 | getJasmineRequireObj().toBeTrue = function() {
'use strict';
/**
* {@link expect} the actual value to be `true`.
* @function
* @name matchers#toBeTrue
* @since 3.5.0
* @example
* expect(result).toBeTrue();
*/
function toBeTrue() {
return {
compare: function(actual) {
return... |
d54af433affadfb763dd45e4d64bca6ea9c5c0533a1b267340cdbe837a6f23f8 | JavaScript | 408 | 23 | getJasmineRequireObj().toBeNull = function() {
'use strict';
/**
* {@link expect} the actual value to be `null`.
* @function
* @name matchers#toBeNull
* @since 1.3.0
* @example
* expect(result).toBeNull();
*/
function toBeNull() {
return {
compare: function(actual) {
return... |
e59e301e71cf21c9d281c0be486e55b914e8b8a6f3517d96176853d0da3f1f11 | JavaScript | 408 | 17 | 'use strict'
module.exports = function () {
if (!process.env.npm_config_user_agent) {
return undefined
}
return pmFromUserAgent(process.env.npm_config_user_agent)
}
function pmFromUserAgent (userAgent) {
const pmSpec = userAgent.split(' ')[0]
const separatorPos = pmSpec.lastIndexOf('/')
return {
n... |
818d669f01e5578030b42545e5c91be011181d56e97489f5e7bed344e5a9751e | JavaScript | 410 | 23 | getJasmineRequireObj().toBeTruthy = function() {
'use strict';
/**
* {@link expect} the actual value to be truthy.
* @function
* @name matchers#toBeTruthy
* @since 2.0.0
* @example
* expect(thing).toBeTruthy();
*/
function toBeTruthy() {
return {
compare: function(actual) {
... |
04255e482e181687823a95b207802ddd32e746c65dce4c95a5176fc192735960 | JavaScript | 411 | 18 | /*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
module.exports = function(num) {
if (typeof num === 'number') {
return num - num === 0;
}
if (typeof num === 'string' && num.trim() !== '') {
... |
2b6890e12e4be79c308be4fcbfed9e47f3bed6ad35d15924e8be904b77d3d2a4 | JavaScript | 415 | 23 | getJasmineRequireObj().toBeFalse = function() {
'use strict';
/**
* {@link expect} the actual value to be `false`.
* @function
* @name matchers#toBeFalse
* @since 3.5.0
* @example
* expect(result).toBeFalse();
*/
function toBeFalse() {
return {
compare: function(actual) {
r... |
151533dc24188efc853a48b6333fc36306f97b00d32ae52a7bd22b20ade5c6b4 | JavaScript | 416 | 20 | (function() {
let doc;
if (typeof document !== 'undefined') {
doc = document;
} else {
const JSDOM = require('jsdom').JSDOM;
const dom = new JSDOM();
doc = dom.window.document;
}
specHelpers.domHelpers = {
document: doc,
createElementWithClassName(className) {
const el = this.d... |
09f8b2d572fd8078534a65f82ae31b77e0fc581d88d5e016d5b10dd8b18e9d7c | JavaScript | 417 | 19 | window.MathJax = {
tex: {
inlineMath: [["\\(", "\\)"]],
displayMath: [["\\[", "\\]"]],
processEscapes: true,
processEnvironments: true
},
options: {
ignoreHtmlClass: ".*|",
processHtmlClass: "arithmatex"
}
};
document$.subscribe(() => {
MathJax.startup.output... |
083d2cbc5cb94fd79f00382bb588d5bf6b08f39b7ead73dd0eb9b04cc1783548 | JavaScript | 418 | 23 | var port = require('port');
port({
'read': 8005,
'write': 8006,
'encoding': 'ascii',
'basepath': __dirname,
'flags': {
'noprefs': true,
'stderr': true,
'send': 'pd dsp 1, dsp 0',
'open': './port.pd'
}
})
.on('connect', function(){
console.log('on connect');
this.write('a message to pd;\n');
})
.on('std... |
b802db5a66692ef07fd2ab1ebee0883bcc61ddf861751756a6d9afb0a887b87a | JavaScript | 426 | 13 | const path = require('path');
const jasmineBrowser = require('jasmine-browser-runner');
const jasmineCore = require('../../lib/jasmine-core');
const config = require(path.resolve('spec/support/jasmine-browser.js'));
config.clearReporters = true;
config.jasmineCore = jasmineCore;
jasmineBrowser.runSpecs(config).catch(... |
2811e92794427b5f7d7fac2e0744f101626ac002af621ecc470dd68f1fc247bb | JavaScript | 431 | 24 | var port = require('../port');
port({
'read': 8205, // [netsend]
'write': 8206, // [netreceive]
'encoding': 'ascii',
'basepath': __dirname,
'flags': {
'noprefs': true,
'stderr': true,
'nogui': true,
'open': 'io-print.pd'
}
})
.on('connect', function(socket){
// receive data from [print]
this.on('stderr... |
61fe0c440af0d4d48f94d47fd2adf7ff5a30e6ea58895444199a95cb33cc4ffc | JavaScript | 434 | 18 | (function() {
specHelpers.requiresBrowser = function() {
if (typeof window === 'undefined') {
notApplicable('This test only runs in browsers.');
}
};
specHelpers.requiresNode = function() {
const isNode =
typeof process !== 'undefined' &&
process.versions &&
typeof process.ver... |
6518cf679802a8c2c439c9dcf31a52023c01e31183a77c7060678896d0ce85cc | JavaScript | 438 | 16 | #!/usr/bin/env node
const cli = require('../lib/cli');
const nodemon = require('../lib/');
const options = cli.parse(process.argv);
nodemon(options);
const fs = require('fs');
// checks for available update and returns an instance
const pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
if (pkg.ver... |
9e966ba7778f10442ff3b87057194d219e3b706739b53a6ad036bbcbca06ce44 | JavaScript | 439 | 21 | 'use strict';
const path = require('path');
module.exports = (childPath, parentPath) => {
childPath = path.resolve(childPath);
parentPath = path.resolve(parentPath);
if (process.platform === 'win32') {
childPath = childPath.toLowerCase();
parentPath = parentPath.toLowerCase();
}
if (childPath === parentPath... |
d3e912a73e756780c98551f950ba81bd4e1e41cb74952a426af17c141f7da5e9 | JavaScript | 440 | 23 | getJasmineRequireObj().toBeUndefined = function() {
'use strict';
/**
* {@link expect} the actual value to be `undefined`.
* @function
* @name matchers#toBeUndefined
* @since 1.3.0
* @example
* expect(result).toBeUndefined():
*/
function toBeUndefined() {
return {
compare: function... |
68be041dd0379d295d89550d1f6f2e8c29645bdd92d14b427fe2e140b3c8f2f8 | JavaScript | 441 | 20 | /*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function isExtglob(str) {
if (typeof str !== 'string' || str === '') {
return false;
}
var match;
while ((match = /(\\).|([@?!+*]\(.*\))/g.... |
1f219d184050f877776e2ccd8a724fc8d8ad28b3fc7da3ef03f336ee6ceecd32 | JavaScript | 442 | 13 | describe('toBeDefined', function() {
it('matches for defined values', function() {
const matcher = privateUnderTest.matchers.toBeDefined();
const result = matcher.compare('foo');
expect(result.pass).toBe(true);
});
it('fails when matching undefined values', function() {
const matcher = privateUnd... |
ef6b6a215c425c1b29d34f2f5d1da55f9932070ae3cccfcca3753648cb00cc6e | JavaScript | 442 | 20 | getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$, private$) {
'use strict';
const availableMatchers = [
'toBePending',
'toBeResolved',
'toBeRejected',
'toBeResolvedTo',
'toBeRejectedWith',
'toBeRejectedWithError',
'toBeRejectedWithMatching'
];
const matchers = {};... |
2e8b03929f66ae4aba206848c881619acda19114aaa1e58e3896c2c61067e1f4 | JavaScript | 444 | 23 | getJasmineRequireObj().toBeDefined = function() {
'use strict';
/**
* {@link expect} the actual value to be defined. (Not `undefined`)
* @function
* @name matchers#toBeDefined
* @since 1.3.0
* @example
* expect(result).toBeDefined();
*/
function toBeDefined() {
return {
compare: fu... |
325810e406ed149c308797bfc4812eef817de82e5bb58fb4470303acace16b06 | JavaScript | 447 | 13 | describe('toBeUndefined', function() {
it('passes for undefined values', function() {
const matcher = privateUnderTest.matchers.toBeUndefined();
const result = matcher.compare(void 0);
expect(result.pass).toBe(true);
});
it('fails when matching defined values', function() {
const matcher = privat... |
fa1d528ba6f5ddb792dd611aadd3209e817dfd735eda39ae173ebd45d1290ca7 | JavaScript | 459 | 23 | getJasmineRequireObj().toBeNullish = function() {
'use strict';
/**
* {@link expect} the actual value to be `null` or `undefined`.
* @function
* @name matchers#toBeNullish
* @since 5.6.0
* @example
* expect(result).toBeNullish():
*/
function toBeNullish() {
return {
compare: functi... |
5f9beff594347ba6765b806ec36e25699be1407627e2ee91be5d609e40baacb8 | JavaScript | 460 | 17 | 'use strict'
var experimentalWarnings = new Set();
function emitExperimentalWarning(feature) {
if (experimentalWarnings.has(feature)) return;
var msg = feature + ' is an experimental feature. This feature could ' +
'change at any time';
experimentalWarnings.add(feature);
process.emitWarning(msg, 'Exper... |
1d4f5429eb401e0bee740a80079f3e8a3f472e4ebc3a6b1a0a365f021e5a8335 | JavaScript | 474 | 31 | const XHR = require("./polling");
const JSONP = require("./polling-jsonp");
/**
* Export transports.
*/
module.exports = exports = {
polling: polling,
websocket: require("./websocket")
};
/**
* Export upgrades map.
*/
exports.polling.upgradesTo = ["websocket"];
/**
* Polling polymorphic constructor.
*
*... |
5c16e2e5f7101eea3f13c19da7c7a9e6fa02f7d1098b170e71f07d14f915e394 | JavaScript | 488 | 34 | module.exports = {
SIGHUP: 1,
SIGINT: 2,
SIGQUIT: 3,
SIGILL: 4,
SIGTRAP: 5,
SIGABRT: 6,
SIGBUS: 7,
SIGFPE: 8,
SIGKILL: 9,
SIGUSR1: 10,
SIGSEGV: 11,
SIGUSR2: 12,
SIGPIPE: 13,
SIGALRM: 14,
SIGTERM: 15,
SIGSTKFLT: 16,
SIGCHLD: 17,
SIGCONT: 18,
SIGSTOP: 19,
SIGTSTP: 20,
SIGTTIN: 21... |
c4ff3ea62ef65a2c68ea721dcbd58b621150660facd02be95ebfc556c4dd123f | JavaScript | 488 | 9 | exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = exports;
exports.Readable = exports;
exports.Writable = require('./lib/_stream_writable.js');
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('.... |
6df7c8b218f33abc33563a33de06b4bbb1a43a6232b4c31cb01c55c38ed1cba8 | JavaScript | 490 | 30 | /*!
* toidentifier
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module exports.
* @public
*/
module.exports = toIdentifier
/**
* Trasform the given string into a JavaScript identifier
*
* @param {string} str
* @returns {string}
* @public
*/
function toIdentifier (str) {
retu... |
9f3b17a5048a92871f7121eadc4373703b1ecea79d207c351ea8e109fe642801 | JavaScript | 495 | 11 | (function() {
// By the time onload is called, getJasmineRequireObj() and
// getJasmineHtmlRequireObj() will be redefined to point
// to the Jasmine source files (and not jasmine.js). So re-require.
const jasmineRequire = getJasmineRequireObj();
const coreUnderTest = jasmineRequire.core(jasmineRequire);
win... |
71a627fa70202d02d7906a4ccc59def9c8f85e346132f1cd957fb01b9d43a0cb | JavaScript | 523 | 18 | describe('toBeLessThan', function() {
it('passes when actual < expected', function() {
const matcher = privateUnderTest.matchers.toBeLessThan();
const result = matcher.compare(1, 2);
expect(result.pass).toBe(true);
});
it('fails when actual <= expected', function() {
const matcher = privateUnderT... |
ce3d03fb7e2e189dc131c275c987c60680129dd197d8d430a4fd7d8c679ff1dd | JavaScript | 532 | 18 | describe('toBeGreaterThan', function() {
it('passes when actual > expected', function() {
const matcher = privateUnderTest.matchers.toBeGreaterThan();
const result = matcher.compare(2, 1);
expect(result.pass).toBe(true);
});
it('fails when actual <= expected', function() {
const matcher = private... |
d49b58ca5122f932795e33ea5f575a4079c61d6e3284ae63a0c14b720dfcc291 | JavaScript | 533 | 25 | getJasmineHtmlRequireObj().ResultsNode = function() {
'use strict';
function ResultsNode(result, type, parent) {
this.result = result;
this.type = type;
this.parent = parent;
this.children = [];
this.addChild = function(result, type) {
this.children.push(new ResultsNode(result, type, th... |
85519c4a952dd76fe38ce40636cc53900120c6cd9017bc83691dcb28d322f0ce | JavaScript | 534 | 24 | getJasmineRequireObj().toBeLessThan = function() {
'use strict';
/**
* {@link expect} the actual value to be less than the expected value.
* @function
* @name matchers#toBeLessThan
* @since 2.0.0
* @param {Number} expected - The expected value to compare against.
* @example
* expect(result).to... |
636774fca903a0d76193c37fce077a33e5ea844ef3cb2f87b0b3661a65007096 | JavaScript | 543 | 24 | getJasmineRequireObj().toBeGreaterThan = function() {
'use strict';
/**
* {@link expect} the actual value to be greater than the expected value.
* @function
* @name matchers#toBeGreaterThan
* @since 2.0.0
* @param {Number} expected - The value to compare against.
* @example
* expect(result).to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.