sha256 stringlengths 64 64 | language stringclasses 25
values | size int32 1 210k | lines int32 1 9.41k | content stringlengths 1 200k |
|---|---|---|---|---|
811ca06b4780ad3719f05f387a961f942a6b3a8bdd35472def4442d9f29dfad4 | JavaScript | 2,298 | 87 | getJasmineHtmlRequireObj().ResultsStateBuilder = function(j$, private$) {
'use strict';
class ResultsStateBuilder {
constructor() {
this.topResults = new private$.ResultsNode({}, '', null);
this.currentParent = this.topResults;
this.suitesById = {};
this.totalSpecsDefined = 0;
thi... |
c9cb46c9bc894fdc29ecf4b15c2ee44e4a3c25c91f0fd6209f636aa0b21d40aa | JavaScript | 2,310 | 93 | 'use strict';
const {PassThrough} = require('stream');
const duplexer3 = require('duplexer3');
const requestAsEventEmitter = require('./request-as-event-emitter');
const {HTTPError, ReadError} = require('./errors');
module.exports = options => {
const input = new PassThrough();
const output = new PassThrough();
con... |
9ca35bc3647814a9b37bd497da47eb2e52bb9317ab76f37cdef49ebed1840d43 | JavaScript | 2,324 | 96 | 'use strict';
const {Transform} = require('stream');
module.exports = {
download(response, emitter, downloadBodySize) {
let downloaded = 0;
return new Transform({
transform(chunk, encoding, callback) {
downloaded += chunk.length;
const percent = downloadBodySize ? downloaded / downloadBodySize : 0;
... |
516efe52b18b29b36b9ac4ed1d679a497e0846b269a9cf101fb405fbcc8b402b | JavaScript | 2,334 | 60 | /**
* Usage: node test.js
*/
var mime = require('../mime');
var assert = require('assert');
var path = require('path');
//
// Test mime lookups
//
assert.equal('text/plain', mime.lookup('text.txt')); // normal file
assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase
assert.equal('text/plain',... |
fc557c23f6b2effebc75878c7185424b2dd436df2df137791fdc6816ceec0ff2 | JavaScript | 2,339 | 125 | 'use strict'
// These tables borrowed from `ansi`
var prefix = '\x1b['
exports.up = function up (num) {
return prefix + (num || '') + 'A'
}
exports.down = function down (num) {
return prefix + (num || '') + 'B'
}
exports.forward = function forward (num) {
return prefix + (num || '') + 'C'
}
exports.back = f... |
e81e360f3f9d1aa50a3b065eb2333250fdbd7735a1479b2b8c00270c41577578 | JavaScript | 2,364 | 86 | getJasmineRequireObj().util = function(j$, private$) {
'use strict';
const util = {};
util.shallowCopy = function(obj) {
if (Object.prototype.toString.apply(obj) === '[object Array]') {
return obj.slice();
}
return { ...obj };
};
util.shallowCopyArgs = function(args) {
return Array.f... |
b22f3bccc756717cccf3841102c662960ec5831c3600c7a8d8c2d8ceade168fa | JavaScript | 2,365 | 103 | /*!
* base64id v0.1.0
*/
/**
* Module dependencies
*/
var crypto = require('crypto');
/**
* Constructor
*/
var Base64Id = function() { };
/**
* Get random bytes
*
* Uses a buffer if available, falls back to crypto.randomBytes
*/
Base64Id.prototype.getRandomBytes = function(bytes) {
var BUFFER_SIZE = ... |
d91490dcfdb322e77be2b9aa64a8c7efe91388ba171e8c9b6711230fe29a3648 | JavaScript | 2,384 | 127 | /**
* Module dependencies.
*/
const http = require("http");
const Server = require("./server");
/**
* Invoking the library as a function delegates to attach if the first argument
* is an `http.Server`.
*
* If there are no arguments or the first argument is an options object, then
* a new Server instance is ret... |
cb176ccd3d262af3c8b704ead34d33b513668362bf10a09e2668f4acf14047b6 | JavaScript | 2,401 | 92 | getJasmineRequireObj().Deprecator = function(j$, private$) {
'use strict';
function Deprecator(topSuite) {
this.topSuite_ = topSuite;
this.verbose_ = false;
this.toSuppress_ = [];
}
const verboseNote =
'Note: This message will be shown only once. Set the verboseDeprecations ' +
'config pro... |
ef291b3539b2cf9190db16eb37d6b6b73afc40c4adaf8f80b5c05718556b41f2 | JavaScript | 2,401 | 81 |
// Query string used for cache busting
// See the following site for details
// https://netamame.com/cache-busting/
// const APP_VER = '?23v2';
// Project root
const APP_ROOT = '/abx_app/';
// const APP_ROOT = '../'; // for CGI
// Static root
const STATIC_ROOT = '/static/';
// const STATIC_ROOT = '../../static/'; //... |
2f25585c03c3050779c8f5f00597f8653f4fb8a97448ef8ef8cb21e65ba4d15d | JavaScript | 2,409 | 116 | /*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Module dependencies.
*/
var bodyParser = require('body-parser')
var EventEmitter = require('events').EventEmitter;
var mixin = req... |
42e9896c6f5de926d13a2624387fbe2639aabbe420f6d31d1361c01d72c169d7 | JavaScript | 2,414 | 71 | const { Transform } = require('stream')
/**
* Emits data if there is a pause between packets for the specified amount of time.
* @extends Transform
* @param {Object} options parser options object
* @param {Number} options.interval the period of silence in milliseconds after which data is emited
* @param {Number} ... |
66f0205d474fe1d6d786fb26b24b7ed3a3ef55e96a2232e94e596cc778157fc0 | JavaScript | 2,423 | 68 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* Extension of the 'text' plugin specially for loading shaders
* FEATURES :
* - Supports #include statements to combine shaders
* - Can use the define function to change the value of
* #define statments in the s... |
16576b2011c78d0c5ceccdeba7451e83e1bd86f2c3f31c05de7df4ccfb149c2a | JavaScript | 2,428 | 97 | // Ported from https://github.com/mafintosh/pump with
// permission from the author, Mathias Buus (@mafintosh).
'use strict';
var eos;
function once(callback) {
var called = false;
return function () {
if (called) return;
called = true;
callback.apply(void 0, arguments);
};
}
var _require$codes = r... |
1754eeb5b5082d9e36d64199321c3fa38066b629abb243f25170199960eacb7c | JavaScript | 2,430 | 87 | getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$, private$) {
'use strict';
const getErrorMsg = private$.formatErrorMsg(
'<toHaveNoOtherSpyInteractions>',
'expect(<spyObj>).toHaveNoOtherSpyInteractions()'
);
/**
* {@link expect} the actual (a {@link SpyObj}) spies to have not been ... |
777b6ba3b4a0407ccd87364caf4d203911b558be1de41b09c258b7936ed5d5bb | JavaScript | 2,451 | 112 | 'use strict';
exports.isInteger = num => {
if (typeof num === 'number') {
return Number.isInteger(num);
}
if (typeof num === 'string' && num.trim() !== '') {
return Number.isInteger(Number(num));
}
return false;
};
/**
* Find a node of the given type
*/
exports.find = (node, type) => node.nodes.f... |
af03e46da8bb044e34a7afdfe138bd87940625bf715737ec11399523787de31e | JavaScript | 2,455 | 88 | describe('QueryString', function() {
describe('#navigateWithNewParam', function() {
it('sets the query string to include the given key/value pair', function() {
const windowLocation = {
search: ''
};
const queryString = new jasmineUnderTest.QueryString({
getWindowLocation: functi... |
f73b0646d931f35d290ce242fb9cddb75e5142cbae134a36e89dff4c2e265f14 | JavaScript | 2,460 | 109 | 'use strict';
const path = require('path');
const os = require('os');
const fs = require('graceful-fs');
const makeDir = require('make-dir');
const xdgBasedir = require('xdg-basedir');
const writeFileAtomic = require('write-file-atomic');
const dotProp = require('dot-prop');
const uniqueString = require('unique-string'... |
5071083e2e09969b2741a46cdedbbfcb2608fa35c1d1237e3bcf134749fb5ecd | JavaScript | 2,465 | 100 | module.exports = version;
module.exports.pin = pin;
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
var root = null;
function pin() {
return version().then(function (v) {
version.pinned = v;
});
}
function version(callback) {
// first find the package.json as t... |
92c4524c29925537d081286b0ac958f874aa800f167400fd87cea95c42e0a86d | JavaScript | 2,466 | 83 | #!/usr/bin/env node
var path = require('path')
var fs = require('fs')
var whichPmRuns = require('which-pm-runs')
var napi = require('napi-build-utils')
var pkg = require(path.resolve('package.json'))
var rc = require('./rc')(pkg)
var log = require('./log')(rc, process.env)
var download = require('./download')
var ass... |
a95a23b9a60726a4522b768c88ad73a7ea2c539d220068227f5510a8ee2008ae | JavaScript | 2,479 | 131 | /*!
* etag
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
module.exports = etag
/**
* Module dependencies.
* @private
*/
var crypto = require('crypto')
var Stats = require('fs').Stats
/**
* Module variables.
* @private
*/
var toS... |
b18cbd1238e8e7b228517641670b0d31a8f4110dc96acbe4aa120d82a586b92e | JavaScript | 2,481 | 100 | const childProcess = require('child_process')
const Readline = require('@serialport/parser-readline')
// get only serial port names
function checkPathOfDevice(path) {
return /(tty(S|WCH|ACM|USB|AMA|MFD|O|XRUSB)|rfcomm)/.test(path) && path
}
function propName(name) {
return {
DEVNAME: 'path',
ID_VENDOR_ENC... |
9aa09128eed9dcb64e589c43c020edfce06db26313941782422961c909500e68 | JavaScript | 2,497 | 93 | getJasmineRequireObj().Expector = function(j$, private$) {
'use strict';
function Expector(options) {
this.matchersUtil = options.matchersUtil || {
buildFailureMessage: function() {}
};
this.actual = options.actual;
this.addExpectationResult = options.addExpectationResult || function() {};
... |
59d3b0b7a261a3a0631d0a8ceb31bee889e127ebb8d5a4963b75b7547a85f206 | JavaScript | 2,504 | 70 | describe('HtmlReporterV2Urls', function() {
describe('#configFromCurrentUrl', function() {
passesThroughQueryParam('stopOnSpecFailure');
passesThroughQueryParam('stopSpecOnExpectationFailure');
passesThroughQueryParam('random');
ignoresEmpty('random');
passesThroughQueryParam('seed');
ignoresE... |
be155df5dbc29c88c67c936f2840d2bb3abd09981fdb6db6480d54beeb27e9fe | JavaScript | 2,511 | 93 | /**
* Manages the internal config of nodemon, checking for the state of support
* with fs.watch, how nodemon can watch files (using find or fs methods).
*
* This is *not* the user's config.
*/
var debug = require('debug')('nodemon');
var load = require('./load');
var rules = require('../rules');
var utils = requir... |
cb5fff33c884f33a9afe6c57727843d2c1d355eafb7f025cd8cf58681f66a7ac | JavaScript | 2,522 | 74 | describe('ArrayContaining', function() {
it('matches any actual to an empty array', function() {
const containing = new privateUnderTest.ArrayContaining([]);
expect(containing.asymmetricMatch('foo')).toBe(true);
});
it('does not work when not passed an array', function() {
const containing = new pri... |
a96a21b80947536145dff3e1a2e60af59cc612b315f6f6c7a18304f58593d873 | JavaScript | 2,527 | 83 | //TODO: expectation result may make more sense as a presentation of an expectation.
getJasmineRequireObj().buildExpectationResult = function(j$, private$) {
'use strict';
function buildExpectationResult(options) {
const exceptionFormatter = new private$.ExceptionFormatter();
/**
* Describes the resul... |
793ee08de7ae2becd336189b6714087c262bfde80af862aa3fd197dce2369946 | JavaScript | 2,534 | 104 | 'use strict';
/**
* Checks if a status code is allowed in a close frame.
*
* @param {Number} code The status code
* @return {Boolean} `true` if the status code is valid, else `false`
* @public
*/
function isValidStatusCode(code) {
return (
(code >= 1000 &&
code <= 1014 &&
code !== 1004 &&
... |
04b227c0c9545091e8eafa5e018dc64c82612163ab4e2c36e233137cb678f944 | JavaScript | 2,541 | 102 | var parse = require('../');
var test = require('tape');
test('boolean and alias is not unknown', function (t) {
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = [ '-h', 'true', '--derp', 'true' ];
var regular = [ '--herp', 'true', '-d', '... |
8d72af81244b1fa40bb4cf08f31bee4e4dcdbb50702f230f6fb41ac638a940f3 | JavaScript | 2,565 | 89 | describe('buildExpectationResult', function() {
it('defaults to passed', function() {
const result = privateUnderTest.buildExpectationResult({
passed: 'some-value'
});
expect(result.passed).toBe('some-value');
});
it('message defaults to Passed for passing specs', function() {
const result ... |
986adade95d3f8aa6822d5c0546b6c11d2bce90d3544f04b056f15d15e2a1429 | JavaScript | 2,567 | 98 | getJasmineHtmlRequireObj().PerformanceView = function(j$, private$) {
const createDom = private$.htmlReporterUtils.createDom;
const MAX_SLOW_SPECS = 20;
class PerformanceView {
#summary;
#tbody;
constructor() {
this.#tbody = document.createElement('tbody');
this.#summary = document.creat... |
5a8acbef98f9574211d57a0be0718c31231d5d7f8d14b828b742321d65e700f7 | JavaScript | 2,580 | 102 | var noop = function () { };
var path = require('path');
const semver = require('semver');
var version = process.versions.node.split('.') || [null, null, null];
var utils = (module.exports = {
semver: semver,
satisfies: test => semver.satisfies(process.versions.node, test),
version: {
major: parseInt(version[... |
deee84895f5d5d701c4f8ec15eace895de636698c654c194bd8b546fde70c75c | JavaScript | 2,589 | 109 | getJasmineRequireObj().MockDate = function(j$, private$) {
'use strict';
function MockDate(global) {
let currentTime = 0;
if (!global || !global.Date) {
this.install = function() {};
this.tick = function() {};
this.uninstall = function() {};
return this;
}
const GlobalDate... |
b8d8c4c0e326eb8c8a337111156331cc1098c29de36cfa82a327dab8eab672c4 | JavaScript | 2,590 | 81 | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StrictEventEmitter = void 0;
const events_1 = require("events");
/**
* Strictly typed version of an `EventEmitter`. A `TypedEventEmitter` takes type
* parameters for mappings of event names to event data types, and strictly
* types ... |
5f14102f5bb897e4f97494576763e58b8d70eea61df42e08e8b01eeb110ead68 | JavaScript | 2,595 | 125 | 'use strict';
function undefsafe(obj, path, value, __res) {
// I'm not super keen on this private function, but it's because
// it'll also be use in the browser and I wont *one* function exposed
function split(path) {
var res = [];
var level = 0;
var key = '';
for (var i = 0; i < path.length; i+... |
5acdcc24679abe5f1f1ec70e3b8fba3ee473ab3a70d3d6b37456c8b7383d6821 | JavaScript | 2,603 | 131 | var expect = require('expect.js');
var port = require('../');
describe('Port Events', function(){
it('should test the scope of all event callbacks and check Port.isRunning', function(done){
var pd = port({
'read': 8015, // [netsend]
'write': 8016, // [netreceive]
'basepath': __dirname,
'flags': {
... |
54f3bba4f7bdfa013284e7f7fab0616b0846187c8c9a3998b80445991415ab0d | JavaScript | 2,612 | 112 | #!/usr/bin/env node
const touch = require("../index.js")
const usage = code => {
console[code ? 'error' : 'log'](
'usage:\n' +
'touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...'
)
process.exit(code)
}
const singleFlags = {
a: 'atime',
m: 'mtime',
c: 'nocreate',
f: 'force'
}
const sin... |
33141436365765d92db7e67261d83016fb5b491f90d73d13ca47e849f141f9b8 | JavaScript | 2,624 | 110 | const { promisify } = require('util')
const binding = require('bindings')('bindings.node')
const AbstractBinding = require('@serialport/binding-abstract')
const linuxList = require('./linux-list')
const Poller = require('./poller')
const unixRead = require('./unix-read')
const unixWrite = require('./unix-write')
const ... |
6e4f5d6d26baf194cf4bbb4d82110046ed6215205b412c57a7b5097dc1623eac | JavaScript | 2,630 | 98 | var path = require('path');
var fs = require('fs');
var _0777 = parseInt('0777', 8);
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
function mkdirP (p, opts, f, made) {
if (typeof opts === 'function') {
f = opts;
opts = {};
}
else if (!opts || typeof opts !== 'object') {
... |
3805d0cb29dd6f7d22873a24faa0dfc0f1799e63ab01d51360755d6def131283 | JavaScript | 2,635 | 110 | const { promisify } = require('util')
const binding = require('bindings')('bindings.node')
const AbstractBinding = require('@serialport/binding-abstract')
const Poller = require('./poller')
const unixRead = require('./unix-read')
const unixWrite = require('./unix-write')
const { wrapWithHiddenComName } = require('./leg... |
85ec147c394ac0a2429dbe6b0a7b040b254ef26a02bddd7282bca10c73ca5046 | JavaScript | 2,641 | 72 | /** @license
* RequireJS plugin for loading JSON files
* - depends on Text plugin and it was HEAVILY "inspired" by it as well.
* Author: Miller Medeiros
* Version: 0.4.0 (2014/04/10)
* Released under the MIT license
*/
define(['text'], function(text){
var CACHE_BUST_QUERY_PARAM = 'bust',
CACHE_BUST_F... |
8079850c95581b49e791685342c5f3f752ad73e97ac0e46d22d7012fb3c11b60 | JavaScript | 2,645 | 84 | describe('SkipAfterBeforeAllErrorPolicy', function() {
describe('#skipTo', function() {
describe('When nothing has errored', function() {
it('does not skip anything', function() {
const policy = new privateUnderTest.SkipAfterBeforeAllErrorPolicy(
arrayOfArbitraryFns(4)
);
... |
60a6a7ecf7c3e55a3ffaae13433b6cff388b7205bba6daf393c863f77a949e36 | JavaScript | 2,655 | 118 | var Stream = require('stream').Stream
module.exports = legacy
function legacy (fs) {
return {
ReadStream: ReadStream,
WriteStream: WriteStream
}
function ReadStream (path, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
Stream.call(this);
var self = thi... |
d584d690e2a5ffa3b9e7f13db3939a344d34f7ca38dc09b45af7c2fa7fe454e4 | JavaScript | 2,656 | 157 | /*!
* body-parser
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var deprecate = require('depd')('body-parser')
/**
* Cache of loaded parsers.
* @private
*/
var parsers = Object.create(null)
/**
* @typedef Parsers
* @type {fu... |
3cc60361f99b1080c66fce4d6ea0390a38c2a49e821e7f21dc43ed2fafa31277 | JavaScript | 2,662 | 89 | 'use strict';
var utils = require('../utils');
// internal
var reEscComments = /\\#/g;
// note that '^^' is used in place of escaped comments
var reUnescapeComments = /\^\^/g;
var reComments = /#.*$/;
var reEscapeChars = /[.|\-[\]()\\]/g;
var reAsterisk = /\*/g;
module.exports = add;
/**
* Converts file patterns o... |
3e912df226ee90ee3edc5ff69cd3e8313fa1da13795e10fb0b0f05727bdabb58 | JavaScript | 2,678 | 94 | var once = require('once');
var noop = function() {};
var isRequest = function(stream) {
return stream.setHeader && typeof stream.abort === 'function';
};
var isChildProcess = function(stream) {
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
};
var eos = function(stream, opts, cal... |
b455bebe40cab935b7d13c85e3ed04b7235c244aaace8284aa42972021de6c34 | JavaScript | 2,679 | 80 | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.reconstructPacket = exports.deconstructPacket = void 0;
const is_binary_1 = require("./is-binary");
/**
* Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
*
* @param {Object} packet - socket.i... |
424e965a6ea648b39177e2755c8ea6b50b5d40b41c0c29d26bc227af28f60dfb | JavaScript | 2,688 | 111 | const debug = require('debug')
const logger = debug('serialport/bindings/poller')
const EventEmitter = require('events')
const PollerBindings = require('bindings')('bindings.node').Poller
const EVENTS = {
UV_READABLE: 0b0001,
UV_WRITABLE: 0b0010,
UV_DISCONNECT: 0b0100,
}
function handleEvent(error, eventFlag) {... |
4a178ecff5d986b5612029299ac6f4d08c401fe162af30176b501d318b25b753 | JavaScript | 2,698 | 73 | function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
/**
* Removes excluded text from a Node.
*
* @param {Node} target Node to filter.
* @param {string} exclude CSS selector of nodes to exclude.
* @returns {DOMString} Text from `target` w... |
2d5a894ba17f7461ebf0e5f0b5f256fe0d036af0ce455f3039ee33a3674d53d1 | JavaScript | 2,699 | 93 | /*
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2026 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights ... |
befc9e2f8c340c336af168f5a2120165683545bed9ece57dd2a97267d91d3a33 | JavaScript | 2,707 | 89 | describe('toThrowMatching', function() {
it('throws an error when the actual is not a function', function() {
const matcher = privateUnderTest.matchers.toThrowMatching();
expect(function() {
matcher.compare({}, function() {
return true;
});
}).toThrowError(/Actual is not a Function/);... |
85b46ce10c4fba71fb41666586572277f626bbc698266026372941b5267bfb60 | JavaScript | 2,711 | 137 | /*!
* fresh
* Copyright(c) 2012 TJ Holowaychuk
* Copyright(c) 2016-2017 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* RegExp to check for no-cache token in Cache-Control.
* @private
*/
var CACHE_CONTROL_NO_CACHE_REGEXP = /(?:^|,)\s*?no-cache\s*?(?:,|$)/
/**
* Module exports.
* @public
*... |
9c267e934d33015935c8707919d12da4528baa7a164eccfe5530174ddc5845eb | JavaScript | 2,722 | 78 | describe('#toBeRejectedWithMatching', function() {
it('passes if the promise is rejected with something matching the predicate', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = Promise.reject(new Error('nope'));
const predicate = value => value.messag... |
a121a0b9e780e9ae349a26227a0d25c33ebac2d52a85aae5affa84ba0f53f16c | JavaScript | 2,726 | 108 | var path = require('path');
var fs = require('fs');
function Mime() {
// Map of extension -> mime type
this.types = Object.create(null);
// Map of mime type -> extension
this.extensions = Object.create(null);
}
/**
* Define mimetype -> extension mappings. Each key is a mime-type that maps
* to an array of... |
479fd04f71a0fed642baa7e57c7e0701ae6f4a450bde8179f96815e6a26752b0 | JavaScript | 2,748 | 135 | 'use strict';
const os = require('os');
const tty = require('tty');
const hasFlag = require('has-flag');
const {env} = process;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false') ||
hasFlag('color=never')) {
forceColor = 0;
} else if (hasFlag('color') ||
hasFlag('colors') |... |
3eba35eafd078a2c4843a11000c06443b5d8b2fea3b682aae20daeea5be66cd2 | JavaScript | 2,759 | 104 | 'use strict';
var fs = require('fs')
var ini = require('ini')
var path = require('path')
var stripJsonComments = require('strip-json-comments')
var parse = exports.parse = function (content) {
//if it ends in .json or starts with { then it must be json.
//must be done this way, because ini accepts everything.
... |
4bd92209cb9dacf3e3773e725acb7aaec43ea9e78540324e4d0f73e5ce9adef7 | JavaScript | 2,764 | 152 | /**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val is not a non-em... |
a3b83aa217410b6441c111014df00092f6e9f6e6fbf26a0aa2414454f4a4055c | JavaScript | 2,770 | 142 | 'use strict';
const isObj = require('is-obj');
const disallowedKeys = [
'__proto__',
'prototype',
'constructor'
];
const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment));
function getPathSegments(path) {
const pathArray = path.split('.');
const parts = [];
for (let... |
2626aab9a13dc645b1746d6ff1c919b7d27adee60729825404f24e70d982acb3 | JavaScript | 2,771 | 131 | 'use strict';
const os = require('os');
const hasFlag = require('has-flag');
const env = process.env;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false')) {
forceColor = false;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=alway... |
0735991ea5eea0619bcfdd70d69e96b0232fef7c207e8e6c3036cdabae831311 | JavaScript | 2,780 | 113 | 'use strict';
const fill = require('fill-range');
const stringify = require('./stringify');
const utils = require('./utils');
const append = (queue = '', stash = '', enclose = false) => {
let result = [];
queue = [].concat(queue);
stash = [].concat(stash);
if (!stash.length) return queue;
if (!queue.lengt... |
2b6e12f8958f0431d6a0ea009be514fc1a811d206f91539e6341120295e2ce85 | JavaScript | 2,787 | 84 |
// Query string used for cache busting
// See the following site for details
// https://netamame.com/cache-busting/
const APP_VER = '?23v2';
// Project root
const APP_ROOT = '/abx_app/';
// const APP_ROOT = '../'; // for CGI
// Static root
const STATIC_ROOT = '/static/';
// const STATIC_ROOT = '../../static/'; // fo... |
73a523895879298b8feaa5302aa11a23a76c27e654c6bd414c156389f1323050 | JavaScript | 2,789 | 115 | 'use strict';
const {URL} = require('url');
const {Agent: HttpAgent} = require('http');
const {Agent: HttpsAgent} = require('https');
const got = require('got');
const registryUrl = require('registry-url');
const registryAuthToken = require('registry-auth-token');
const semver = require('semver');
// These agent optio... |
811223d4a19492ccc642384dc84f0af4ad935557dfe8f63750d7ffd673e40f17 | JavaScript | 2,809 | 158 | /*!
* parseurl
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var url = require('url')
var parse = url.parse
var Url = url.Url
/**
* Module exports.
* @public
*/
module.exports = parseurl
module... |
9d2e4f20afc46a352add4d00c0d15a82bd8cb56a23ed03deb926802d55633026 | JavaScript | 2,842 | 107 | 'use strict';
const urlLib = require('url');
const http = require('http');
const PCancelable = require('p-cancelable');
const is = require('@sindresorhus/is');
class GotError extends Error {
constructor(message, error, options) {
super(message);
Error.captureStackTrace(this, this.constructor);
this.name = 'GotE... |
d139282e078f6e77a60db0a41bbef4c2cf0449dd02fbc965a99df64c81f008d1 | JavaScript | 2,878 | 108 | 'use strict';
const EventEmitter = require('events');
const getStream = require('get-stream');
const is = require('@sindresorhus/is');
const PCancelable = require('p-cancelable');
const requestAsEventEmitter = require('./request-as-event-emitter');
const {HTTPError, ParseError, ReadError} = require('./errors');
const {... |
38786526d000475300728db07455aa21d1e37b0f24e48fbc4cb30136ae30b07b | JavaScript | 2,900 | 162 | /*!
* range-parser
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015-2016 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
module.exports = rangeParser
/**
* Parse "Range" header `str` relative to the given file `size`.
*
* @param {Number} size
* @pa... |
8e40311960636d40473c57e335bbca115036766bf150df296b941256432ab410 | JavaScript | 2,930 | 149 | /*!
* vary
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
*/
module.exports = vary
module.exports.append = append
/**
* RegExp to match field-name in RFC 7230 sec 3.2
*
* field-name = token
* token = 1*tchar
* tchar = "!" / "#" ... |
e51b6213a8da449e23cc99a4858a51269c1a662d95c37b8cc55f85566469e501 | JavaScript | 2,952 | 123 | const binding = require('bindings')('bindings.node')
const AbstractBinding = require('@serialport/binding-abstract')
const { promisify } = require('util')
const serialNumParser = require('./win32-sn-parser')
const asyncList = promisify(binding.list)
const asyncOpen = promisify(binding.open)
const asyncClose = promisif... |
6916ffc83b502963dd8f619ce457a731cc1730e2aaaf77fa3f8bcbb60345ca9d | JavaScript | 3,021 | 107 | // Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modi... |
55986972f5f3c9446f876c576e1cd30fd4f04cd26527efbb5ad834637c740e4c | JavaScript | 3,023 | 162 | /**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val ... |
e5f0b6a946a9b2b356a28557728410717df54ea2f599edb619f9839df6b7b0e9 | JavaScript | 3,024 | 162 | /**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val ... |
7c9083207b648e648c4d076e7bd7d85af73daae58738199eb8c20a465dfdcd19 | JavaScript | 3,034 | 162 | /**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val ... |
da2088dcfa847be2b26a0c4fd46480e2a787b3120bcaceb98555654bbba53631 | JavaScript | 3,044 | 129 | 'use strict';
const { EMPTY_BUFFER } = require('./constants');
/**
* Merges an array of buffers into a new buffer.
*
* @param {Buffer[]} list The array of buffers to concat
* @param {Number} totalLength The total length of buffers in the list
* @return {Buffer} The resulting buffer
* @public
*/
function concat... |
da537b50146155d7158094e8f761f978887df7f95bcaf62628877da90d2c702a | JavaScript | 3,061 | 115 | getJasmineRequireObj().DiffBuilder = function(j$, private$) {
'use strict';
class DiffBuilder {
constructor(config) {
this.prettyPrinter_ =
(config || {}).prettyPrinter || private$.makePrettyPrinter();
this.mismatches_ = new private$.MismatchTree();
this.path_ = new private$.ObjectPat... |
d71cd5f7947719aa90f79dec56690b22e649af314da0324c1c1ab041e3e9ebe4 | JavaScript | 3,063 | 79 | 'use strict';
{
const toggleNavSidebar = document.getElementById('toggle-nav-sidebar');
if (toggleNavSidebar !== null) {
const navSidebar = document.getElementById('nav-sidebar');
const main = document.getElementById('main');
let navSidebarIsOpen = localStorage.getItem('django.admin.navS... |
b657f52bc7376109592a06fa711b91b05ddd35c1f7eb69c4d1f996b177418085 | JavaScript | 3,065 | 102 | 'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const picomatch = require('picomatch');
const normalizePath = require('normalize-path');
/**
* @typedef {(testString: string) => boolean} AnymatchFn
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
* @typedef {AnymatchPattern|Anymat... |
e6522a2df58f21a6cdf8d146f7e85b9a49bcaf68b813dec15068a8e84fc582c3 | JavaScript | 3,081 | 169 | /**
* negotiator
* Copyright(c) 2012 Isaac Z. Schlueter
* Copyright(c) 2014 Federico Romero
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Module exports.
* @public
*/
module.exports = preferredCharsets;
module.exports.preferredCharsets = preferredCharsets;
/**
*... |
e54d2cd6b19e928907655ef4d115335438e1e378c08b5a9000cdcc66fc547643 | JavaScript | 3,088 | 97 | describe('TabBar', function() {
it('initially renders but hides the tabs', function() {
const subject = new privateUnderTest.TabBar([
{ id: 'tab1', label: 'tab 1' }
]);
const tabs = subject.rootEl.querySelectorAll('.jasmine-tab');
expect(tabs.length).toEqual(1);
expect(tabs[0].id).toEqual('t... |
4b4e7a401842f575b4bbf4105834b695363df517a178f23997c42956d96a98fe | JavaScript | 3,096 | 118 | getJasmineHtmlRequireObj().AlertsView = function(j$, private$) {
'use strict';
const { createDom } = private$.htmlReporterUtils;
const errorBarClassName = 'jasmine-bar jasmine-errored';
const afterAllMessagePrefix = 'AfterAll ';
class AlertsView {
#urlBuilder;
constructor(urlBuilder) {
this.#... |
75da6b5b0634012017a6252c6e130335de7775e5a02f10817d02af47afa8bb8d | JavaScript | 3,102 | 104 | // Ported from https://github.com/mafintosh/end-of-stream with
// permission from the author, Mathias Buus (@mafintosh).
'use strict';
var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
function once(callback) {
var called = false;
return function () {
if (called) re... |
c149c1cb2283a6646b3c23539ccaaa7bc45026196bf6eaec5ce9a37e9d604a60 | JavaScript | 3,105 | 113 | const got = require('got')
const path = require('path')
const semver = require('semver')
const { writeFile } = require('fs').promises
async function getJSONFromCDN (urlPath) {
const response = await got(`https://cdn.jsdelivr.net/gh/${urlPath}`)
return JSON.parse(response.body)
}
async function fetchElectronReleas... |
28d6e8b9f1484c5e55e0cc5d1a42fc27e03889caf2bf621bef9b0334ebfdcfd7 | JavaScript | 3,111 | 118 | 'use strict';
const path = require('path');
const os = require('os');
const fs = require('fs');
const ini = require('ini');
const isWindows = process.platform === 'win32';
const readRc = filePath => {
try {
return ini.parse(fs.readFileSync(filePath, 'utf8')).prefix;
} catch (_) {}
};
const getEnvNpmPrefix = () =... |
54c7b9c8319baeffa83840ae559b5910f530bdca530292d9be190236f219a7b3 | JavaScript | 3,117 | 105 | 'use strict'; // undocumented cb() API, needed for core, not for public API
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writab... |
951713696f119877cca572ed7f28087c472d7ccb35f92c7baa942f4ef09e8422 | JavaScript | 3,124 | 156 | 'use strict';
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const semver = require('semver');
const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0');
// https://github.com/nodejs/node/issues/8987
// https://github.com/libuv/libuv/pull/1088
const ... |
9c67e32e4f371b72c83265a077c7e317866170134ff8dca4cc24313c5037426b | JavaScript | 3,137 | 64 | 'use strict';
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { retur... |
3bed97090594ee68faa329e790e57e5518ba4bb9c07bdae571e2825587359903 | JavaScript | 3,170 | 97 | getJasmineRequireObj().toHaveBeenCalledBefore = function(j$, private$) {
'use strict';
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledBefore>',
'expect(<spyObj>).toHaveBeenCalledBefore(<spyObj>)'
);
/**
* {@link expect} the actual value (a {@link Spy}) to have been called before ano... |
98da2f2046d05e2cbdb9ca05100701426faf22d0e388af6342af5a8335a16744 | JavaScript | 3,201 | 107 | describe('toThrow', function() {
it('throws an error when the actual is not a function', function() {
const matcher = privateUnderTest.matchers.toThrow();
expect(function() {
matcher.compare({});
matcherComparator({});
}).toThrowError(/Actual is not a Function/);
});
it('fails if actual ... |
8ee36793b1f20ac9debc42a329bed5e8d3729e1af68f48edff143094726749c1 | JavaScript | 3,202 | 108 | getJasmineRequireObj().toHaveBeenCalledWith = function(j$, private$) {
'use strict';
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledWith>',
'expect(<spyObj>).toHaveBeenCalledWith(...arguments)'
);
/**
* {@link expect} the actual (a {@link Spy}) to have been called with particular ar... |
aa9d675ba38166ca45357b2b725a977f16395cd262fddccfe231be6eac5ba982 | JavaScript | 3,226 | 101 | describe('#toBeRejectedWith', function() {
it('should return true if the promise is rejected with the expected value', function() {
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = Promise.re... |
beeef4c39fb6b32f2c5b2ef59e9cf09de45d3c2516299d0ed811654a6b1aeb32 | JavaScript | 3,231 | 107 | 'use strict'
var util = require('util')
var TrackerBase = require('./tracker-base.js')
var Tracker = require('./tracker.js')
var TrackerStream = require('./tracker-stream.js')
var TrackerGroup = module.exports = function (name) {
TrackerBase.call(this, name)
this.parentGroup = null
this.trackers = []
this.comp... |
108caf4985f410dfde95141a57b9b1b8f80712484bd1dc2ff5d74883315c5539 | JavaScript | 3,261 | 117 | getJasmineHtmlRequireObj().OverallStatusBar = function(j$, private$) {
'use strict';
const { createDom } = private$.htmlReporterUtils;
const staticClassNames = 'jasmine-overall-result jasmine-bar';
class OverallStatusBar {
#urlBuilder;
constructor(urlBuilder) {
this.#urlBuilder = urlBuilder;
... |
12ad80201590d26d3f6c57816c674c8f973c20624533df7d590098c584a4ca41 | JavaScript | 3,288 | 103 | describe('toHaveBeenCalledTimes', function() {
it('passes when the actual 0 matches the expected 0 ', function() {
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes();
const calledSpy = new privateUnderTest.Spy('called-spy');
const result = matcher.compare(calledSpy, 0);
expect(result.pa... |
8e6ad44d4b87d2edd2abbb6cea713a7947a7c43b8cd2f759073d3a5a12d4e6a7 | JavaScript | 3,293 | 175 |
/**
* Expose `Emitter`.
*/
if (typeof module !== 'undefined') {
module.exports = Emitter;
}
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
f... |
c90709dcba8d9a6cfd1f2b4ef6d7a22d833e317f0c876d884342cee5a96f8a02 | JavaScript | 3,296 | 181 | /*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Module dependencies.
* @private
*/
var pathRegexp = require('path-to-regexp');
var debug = require('debug')('express:router:layer... |
660735ab0cff60743db2bd1b07ddcaeeef45ae655df25cb0ca7f4f8238e27b9a | JavaScript | 3,312 | 110 | getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$, private$) {
'use strict';
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledOnceWith>',
'expect(<spyObj>).toHaveBeenCalledOnceWith(...arguments)'
);
/**
* {@link expect} the actual (a {@link Spy}) to have been called exactl... |
18a0f81c563bc7bd2c9fa13faba51fd5ec0efa66a3c973ff0f99c38ec7737aba | JavaScript | 3,315 | 91 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* Extension of the 'text' plugin specially for loading shaders
* FEATURES :
* - Supports #include statements to combine shaders
* - Can use the define function to change the value of
* #define statments in the s... |
e7dbd7ee3ad042ba88fa1b2046b81d7720556f89745d2ccd3a76c8ce1e942953 | JavaScript | 3,325 | 141 | getJasmineRequireObj().CallTracker = function(j$, private$) {
'use strict';
/**
* @namespace Spy#calls
* @since 2.0.0
*/
function CallTracker() {
let calls = [];
const opts = {};
this.track = function(context) {
if (opts.cloneArgs) {
context.args = opts.argsCloner(context.args... |
78152ed5428dd5357cb4858afc499fbf46c300cc000b24e145a234f69dbfa141 | JavaScript | 3,326 | 182 | /*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Module dependencies.
* @private
*/
var debug = require('debug')('express:view');
var path = require('path');
var fs = require('fs... |
c6fca7c07d17e676c51896b785576a118ccffa934959ddcee7ed106d3f8d4d01 | JavaScript | 3,328 | 129 | /**
* Expose `pathtoRegexp`.
*/
module.exports = pathtoRegexp;
/**
* Match matching groups in a regular expression.
*/
var MATCHING_GROUP_REGEXP = /\((?!\?)/g;
/**
* Normalize the given path string,
* returning a regular expression.
*
* An empty array should be passed,
* which will contain the placeholder
... |
6019e096fc7bc12e4811f0f363e57b7cd60f08b8ea995e15aa33614d99332377 | JavaScript | 3,344 | 124 | /*!
* negotiator
* Copyright(c) 2012 Federico Romero
* Copyright(c) 2012-2014 Isaac Z. Schlueter
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Cached loaded submodules.
* @private
*/
var modules = Object.create(null);
/**
* Module exports.
* @public
*/
module.expo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.