sha256
stringlengths
64
64
language
stringclasses
25 values
size
int32
1
210k
lines
int32
1
9.41k
content
stringlengths
1
200k
592f25c9660ef60ce803225b15e3da5f5d3b1f5b5a4c516dcfb3ca488e06fc8e
JavaScript
1,667
76
"use strict"; var stream = require("stream"); function DuplexWrapper(options, writable, readable) { if (typeof readable === "undefined") { readable = writable; writable = options; options = null; } stream.Duplex.call(this, options); if (typeof readable.read !== "function") { readable = (new ...
e402bd32a14b005fc972dbc6c38beceffabfb521b3af4704647913b010335522
JavaScript
1,672
70
getJasmineRequireObj().ObjectContaining = function(j$, private$) { 'use strict'; function ObjectContaining(sample) { this.sample = sample; } function hasProperty(obj, property) { if (!obj || typeof obj !== 'object') { return false; } if (Object.prototype.hasOwnProperty.call(obj, propert...
a21c9c686b0b626e4bb8deac52b776837b3c97c2b552c7810081874cc48fa445
JavaScript
1,673
50
describe('UserContext', function() { it('Behaves just like an plain object', function() { const context = new privateUnderTest.UserContext(); expect(Object.keys(context)).toEqual([]); }); describe('.fromExisting', function() { describe('when the parameter is a UserContext', function() { it('ret...
29d3cccddc7148f48715bfc94eb6f7b9f9132a5ecb704b9d4b713de87e7603dd
JavaScript
1,684
95
/*! * ee-first * Copyright(c) 2014 Jonathan Ong * MIT Licensed */ 'use strict' /** * Module exports. * @public */ module.exports = first /** * Get the first event in a set of event emitters and event pairs. * * @param {array} stuff * @param {function} done * @public */ function first(stuff, done) { ...
8d3cfaedd7aa7a565f73cd0bcb3e7dac1d5d74b231f7e966f5dcb982d12a1289
JavaScript
1,693
57
const fs = require('fs') const debug = require('debug') const logger = debug('serialport/bindings/unixRead') const { promisify } = require('util') const readAsync = promisify(fs.read) const readable = binding => { return new Promise((resolve, reject) => { binding.poller.once('readable', err => (err ? reject(err...
3fe8c034bfc649c8e80452f4c7052153a49c89a579f3f87a4df6af8bab5ce2b9
JavaScript
1,700
70
'use strict'; var singleComment = 1; var multiComment = 2; function stripWithoutWhitespace() { return ''; } function stripWithWhitespace(str, start, end) { return str.slice(start, end).replace(/\S/g, ' '); } module.exports = function (str, opts) { opts = opts || {}; var currentChar; var nextChar; var insideSt...
756e9c9e4b63048c99e9bbfdbd1a76ce5ad3193cecf94a4232ced8fdf1732607
JavaScript
1,704
59
/* * base64-arraybuffer * https://github.com/niklasvh/base64-arraybuffer * * Copyright (c) 2012 Niklas von Hertzen * Licensed under the MIT license. */ (function(chars){ "use strict"; exports.encode = function(arraybuffer) { var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";...
adb610f9a2fbba92548161871075262496b563dcd0e5e8f5c20f562160a74b34
JavaScript
1,708
81
const conversions = require('./conversions'); const route = require('./route'); const convert = {}; const models = Object.keys(conversions); function wrapRaw(fn) { const wrappedFn = function (...args) { const arg0 = args[0]; if (arg0 === undefined || arg0 === null) { return arg0; } if (arg0.length > 1) ...
5944296c3d169c807f6187b38a3987905692b74865edf9fda438427b950c32fb
JavaScript
1,721
47
describe('ObjectPath', function() { const ObjectPath = privateUnderTest.ObjectPath; it('represents the path to a node in an object tree', function() { expect(new ObjectPath(['foo', 'bar']).toString()).toEqual('$.foo.bar'); }); it('has a depth', function() { expect(new ObjectPath().depth()).toEqual(0);...
a5b637de18f5cdc23b200c6d7ad2755b633a312c314a2c634dc044d320ddb7d9
JavaScript
1,721
48
describe('toHaveClasses', function() { it('fails for a DOM element that lacks all the expected classes', function() { const matcher = privateUnderTest.matchers.toHaveClasses(); const result = matcher.compare( specHelpers.domHelpers.createElementWithClassName(''), ['foo', 'bar'] ); expect(...
e62293e871bdd5a7449ff3c7956c9536ec1d2ea7369461de77322b5256bb93e7
JavaScript
1,723
66
/** * Module dependencies. */ var sep = require('path').sep || '/'; /** * Module exports. */ module.exports = fileUriToPath; /** * File URI to Path function. * * @param {String} uri * @return {String} path * @api public */ function fileUriToPath (uri) { if ('string' != typeof uri || uri.length <...
98e1d9fae9718c37536b01991a634dadf3e6861e7b81bf4a94d4eee14e52f17e
JavaScript
1,724
70
getJasmineRequireObj().toHaveSize = function(j$, private$) { 'use strict'; /** * {@link expect} the actual size to be equal to the expected, using array-like length or object keys size. * @function * @name matchers#toHaveSize * @since 3.6.0 * @param {Object} expected - Expected size * @example ...
bdc4722222c7883f05980293b0dba90daf37d4ff606fd686202350e388ab344b
JavaScript
1,732
47
describe('PrettyPrinter (HTML Dependent)', function() { it('should stringify non-element HTML nodes properly', function() { const sampleNode = document.createTextNode(''); const pp = privateUnderTest.makePrettyPrinter(); expect(pp(sampleNode)).toEqual('HTMLNode'); expect(pp({ foo: sampleNode })).toEqu...
2430869adb61a5e24a3612110a9b49a948e6db43ab7e947c003a9c19c478e609
JavaScript
1,736
70
// Karma configuration // Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/k...
dabbcccb1bf0089d96ce9592a575cb64139926d6b899091c1dbd37632e9269c4
JavaScript
1,738
82
var colour = require('./colour'); var bus = require('./bus'); var required = false; var useColours = true; var coding = { log: 'black', info: 'yellow', status: 'green', detail: 'yellow', fail: 'red', error: 'red', }; function log(type, text) { var msg = '[nodemon] ' + (text || ''); if (useColours) { ...
cba465042558c6b144cc4b3c2f9c6466933f6b8f8ad7ecd25ecfc50ae85e2bcf
JavaScript
1,739
66
'use strict' var vendors = require('./vendors.json') var env = process.env // Used for testing only Object.defineProperty(exports, '_vendors', { value: vendors.map(function (v) { return v.constant }) }) exports.name = null exports.isPR = null vendors.forEach(function (vendor) { var envs = Array.isArray(vendor....
d43e25d3925379c5b1f918fed03534bd0591839453a4f73357e2c36dc82e08b8
JavaScript
1,742
86
let intro_Scene = {}; //// Start screen scene intro_Scene.Start = { init: function () { // Place an invisible button over the entire screen this.button_screen = createButton(''); this.button_screen.size(document.body.clientWidth, document.body.clientHeight); this.button_screen.pos...
5f6c79dc87d7fa32cb4165d02313018c605881e2ff26380d4742a4fd3c0161a2
JavaScript
1,746
55
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasBinary = exports.isBinary = void 0; const withNativeArrayBuffer = typeof ArrayBuffer === "function"; const isView = (obj) => { return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj.buffe...
bf61450b1ff5f94fea9d46665e931119642034c903e63cc224b4c96472eed4d4
JavaScript
1,753
47
// 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...
7db24c9c5d58273ba32eee1bec3dfebd393fdeddd0b5879ef01dc595476e6979
JavaScript
1,756
50
/* eslint-disable yoda */ 'use strict'; const isFullwidthCodePoint = codePoint => { if (Number.isNaN(codePoint)) { return false; } // Code points are derived from: // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt if ( codePoint >= 0x1100 && ( codePoint <= 0x115F || // Hangul Jamo codePoint === ...
906dae046928f840df7693081d7dc8f5f062773badb6658e201a382b97f7eda0
JavaScript
1,762
67
var test = require('tape') var Expand = require('./') test('default expands {} placeholders', function (t) { var expand = Expand() t.equal(typeof expand, 'function', 'is a function') t.equal(expand('{foo}/{bar}', { foo: 'BAR', bar: 'FOO' }), 'BAR/FOO') t.equal(expand('{foo}{foo}{foo}', { foo: 'FOO' ...
77e68ed8bb552a11a5ece29800e0afe34bcc098d14a1b88dd44273f68be43943
JavaScript
1,763
61
module.exports = exports = abbrev.abbrev = abbrev abbrev.monkeyPatch = monkeyPatch function monkeyPatch () { Object.defineProperty(Array.prototype, 'abbrev', { value: function () { return abbrev(this) }, enumerable: false, configurable: true, writable: true }) Object.defineProperty(Object.prototype, 'a...
a386934550508b5a52ccaf66a469201fdeccd246e0715318d8a7d2d1edfa570f
JavaScript
1,767
50
describe('toHaveClass', function() { it('fails for a DOM element that lacks the expected class', function() { const matcher = privateUnderTest.matchers.toHaveClass(); const result = matcher.compare( specHelpers.domHelpers.createElementWithClassName(''), 'foo' ); expect(result.pass).toBe(f...
63c1666da3d7b113236c84988868db4da905ef25b92100e8222e6030c20498f6
JavaScript
1,768
63
'use strict'; const {sep} = require('path'); const {platform} = process; exports.EV_ALL = 'all'; exports.EV_READY = 'ready'; exports.EV_ADD = 'add'; exports.EV_CHANGE = 'change'; exports.EV_ADD_DIR = 'addDir'; exports.EV_UNLINK = 'unlink'; exports.EV_UNLINK_DIR = 'unlinkDir'; exports.EV_RAW = 'raw'; exports.EV_ERROR ...
1da2031dcce6ca9e6f20303a658d01fd3e03706a643faca79b490cddd995bba6
JavaScript
1,774
77
getJasmineHtmlRequireObj().TabBar = function(j$, private$) { const createDom = private$.htmlReporterUtils.createDom; class TabBar { #tabs; #onSelectTab; // tabSpecs should be an array of {id, label}. // All tabs are initially not visible and not selected. constructor(tabSpecs, onSelectTab) { ...
36d8a2d16e8138fa52ab1fd35348b8591414edd6ee318dc1871fcb51a932dda4
JavaScript
1,784
94
var assert = require('assert'); var delegate = require('..'); describe('.method(name)', function(){ it('should delegate methods', function(){ var obj = {}; obj.request = { foo: function(bar){ assert(this == obj.request); return bar; } }; delegate(obj, 'request').method(...
a7b48157324fdbee0135dfaed33175bbc5370562ee5121bd8391a30c043c12b6
JavaScript
1,794
61
describe('Truthy', function() { it('is true for a non empty string', function() { const truthy = new privateUnderTest.Truthy(); expect(truthy.asymmetricMatch('foo')).toBe(true); expect(truthy.asymmetricMatch('')).toBe(false); }); it('is true for a number that is not 0', function() { const truthy...
50e34152e787c2c9b948c946d147e9e2696a760bbb5068a653aa6c2b3a716ee1
JavaScript
1,803
43
/*global gettext*/ 'use strict'; { window.addEventListener('load', function() { // Add anchor tag for Show/Hide link const fieldsets = document.querySelectorAll('fieldset.collapse'); for (const [i, elem] of fieldsets.entries()) { // Don't hide if fields in this fieldset have erro...
66a2db117eba5a46de65e0a7fe86bad10302b08ed7b027a31c8513d2ce387f5b
JavaScript
1,820
72
'use strict'; const {execFileSync} = require('child_process'); const path = require('path'); const exec = (command, arguments_, shell) => execFileSync(command, arguments_, {encoding: 'utf8', shell}).trim(); const create = (columns, rows) => ({ columns: parseInt(columns, 10), rows: parseInt(rows, 10) }); module.exp...
810ced45a37800a912b5dd8454de4f60afcdef1f8c702d21b5b7f20ceff36756
JavaScript
1,829
57
describe('toBeNullish', function() { it('passes for null values', function() { const matcher = privateUnderTest.matchers.toBeNullish(); const result = matcher.compare(null); expect(result.pass).toBe(true); }); it('passes for undefined values', function() { const matcher = privateUnderTest.matcher...
111db1c60ae226a1e6fd2d56ae362fab9842d4111539e60efb609bb10930aa25
JavaScript
1,839
62
getJasmineRequireObj().toBeRejectedWith = function(j$, private$) { 'use strict'; /** * Expect a promise to be rejected with a value equal to the expected, using deep equality comparison. * @function * @async * @name async-matchers#toBeRejectedWith * @since 3.3.0 * @param {Object} expected - Value...
dc2146099f58c6971f28398074a74c5379f97490d624d71d2c90364044e6aff4
JavaScript
1,845
67
globalThis.isNonMonkeyPatchableClass = function(ctor, makeInstance) { describe('Monkey patching prevention', function() { it(`prevents overwriting ${ctor.name}.prototype`, function() { const existing = ctor.prototype; try { ctor.prototype = {}; expect(ctor.prototype).toBe(existing); ...
7988edb3b3160defffc999d5847755e01ce2f99c964731e3cd42e26573a68361
JavaScript
1,846
55
(function() { specHelpers.registerIntegrationMatchers = function() { jasmine.addMatchers({ toHaveFailedExpectationsForRunnable: function() { return { compare: function(actual, fullName, expectedFailures) { let foundRunnable = false; let expectations = true; ...
72fa9f60ff48129143de2e1c1f624cef0d7f41ad55c7d60d94d1014635299607
JavaScript
1,849
74
'use strict'; /*<replacement>*/ var pna = require('process-nextick-args'); /*</replacement>*/ // 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._...
2b5bb2a5d8e088bf9e016296f5e8a59c4faff3f978e7c4f235b66099eb57eeeb
JavaScript
1,858
73
'use strict'; const {URL} = require('url'); const is = require('@sindresorhus/is'); const knownHookEvents = require('./known-hook-events'); const merge = (target, ...sources) => { for (const source of sources) { for (const [key, sourceValue] of Object.entries(source)) { if (is.undefined(sourceValue)) { conti...
9118129f2ef71d79f853bfd99d45997ff30951432a0cec4ecbf7b1946e7c2c97
JavaScript
1,866
67
getJasmineRequireObj().toBeInstanceOf = function(j$, private$) { 'use strict'; const usageError = private$.formatErrorMsg( '<toBeInstanceOf>', 'expect(value).toBeInstanceOf(<ConstructorFunction>)' ); /** * {@link expect} the actual to be an instance of the expected class * @function * @name m...
300bb558bb443ee7e2eb0d111d3434eba37616c822a5b656720a129f39cbec56
JavaScript
1,875
68
describe('Anything', function() { it('matches a string', function() { const anything = new privateUnderTest.Anything(); expect(anything.asymmetricMatch('foo')).toBe(true); }); it('matches a number', function() { const anything = new privateUnderTest.Anything(); expect(anything.asymmetricMatch(4...
4e9cc80a7ee8bd667c68c264b4c374b28e731246ddb6ec22c3968daf837e30a2
JavaScript
1,884
101
/*! * body-parser * Copyright(c) 2014-2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. */ var bytes = require('bytes') var debug = require('debug')('body-parser:raw') var read = require('../read') var typeis = require('type-is') /** * Module exports. */ module.expor...
809fc29cf35ab0aa76b99cad29182f62c0ae598902481d10f9868eaef71981ee
JavaScript
1,885
64
'use strict'; const path = require('path'); const win32 = process.platform === 'win32'; const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require('./constants'); exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); exports...
ea8490563a229b89f2b779217938f9eb2bcf93dd89de9f7fc5c035632f0934b5
JavaScript
1,894
12
/** * @preserve * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) * * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a> * @see http://github.com/homebrewing/brauhaus-diff * @author <a href="mailto:gary.court@gmail.com">Gary Court</a> * @see http://github.com/garycourt/murmurhash-...
75416bc5bca63b31889fdabe6e29d6f00f696e05c469f868c70829da062fa8f8
JavaScript
1,902
57
const fs = require('fs') const debug = require('debug') const logger = debug('serialport/bindings/unixWrite') const { promisify } = require('util') const writeAsync = promisify(fs.write) const writable = binding => { return new Promise((resolve, reject) => { binding.poller.once('writable', err => (err ? reject(...
ad544689ab58cb73a30ef89b33a10e3a805b5c22bff8b37f7f0c5b9a48f7e34a
JavaScript
1,904
73
'use strict' var stringWidth = require('string-width') module.exports = TemplateItem function isPercent (num) { if (typeof num !== 'string') return false return num.slice(-1) === '%' } function percent (num) { return Number(num.slice(0, -1)) / 100 } function TemplateItem (values, outputLength) { this.overal...
ffffafb257cce866303e72254754d2844419e0d59520c60ba80e4e90a4452d64
JavaScript
1,912
66
getJasmineRequireObj().toBeResolvedTo = function(j$, private$) { 'use strict'; /** * Expect a promise to be resolved to a value equal to the expected, using deep equality comparison. * @function * @async * @name async-matchers#toBeResolvedTo * @since 3.1.0 * @param {Object} expected - Value that ...
bea01e8171c2f548e6f3558237f2e53c7bc2f6a2905542bd671e32ee464fb411
JavaScript
1,915
60
var minimist = require('minimist') var getAbi = require('node-abi').getAbi var detectLibc = require('detect-libc') var napi = require('napi-build-utils') var env = process.env var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || '' // Get the configuration module.exports = function (pkg) { va...
a4ec4b5b7eb2e33b85648173374bbbda2ae37be68e350f6ad9423e76911e647e
JavaScript
1,920
110
/** Very simple chaining mecanism to serially execute asynchronous functions * */ function SerialRunner() { this.last this.first /** first arg if the function to call. * Other args are params. */ this.add = function() { var func = arguments[0] var args = [] for(var i=1; i < arguments.le...
0fcd74d4017a996a3adb4e39ef277e4a4701f00a4687d9ed7faab75a56bf34de
JavaScript
1,924
54
$('#mysidebar').height($(".nav").height()); $( document ).ready(function() { //this script says, if the height of the viewport is greater than 800px, then insert affix class, which makes the nav bar float in a fixed // position as your scroll. if you have a lot of nav items, this height may not work for you....
062fd2959d8d4b4128f82289e0056a727bd6ff05d7ecedcf154de06494d761a7
JavaScript
1,927
82
getJasmineRequireObj().ReportDispatcher = function(j$, private$) { 'use strict'; function ReportDispatcher(methods, runQueue, onLateError) { const dispatchedMethods = methods || []; for (const method of dispatchedMethods) { this[method] = (function(m) { return function(event) { ret...
15b00b6f8a7e50f2e83e3b5eacccbad8746d8378f80699977388616c5c5fd8a0
JavaScript
1,927
66
//https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/ ```mermaid graph TD; A-->B; A-->C; B-->D; C-->D; ``` //https://betterprogramming.pub/accessing-an-objects-keys-values-and-entries-in-javascript-e7bb5d33d11c var user = { name : "John", age : 25 } let entries = O...
24d81b312ede8c0cd2a88893aa9cc3624d443c158584c20aeacfc005e7b7cb85
JavaScript
1,927
103
'use strict'; class CancelError extends Error { constructor(reason) { super(reason || 'Promise was canceled'); this.name = 'CancelError'; } get isCanceled() { return true; } } class PCancelable { static fn(userFn) { return (...args) => { return new PCancelable((resolve, reject, onCancel) => { arg...
cc18a2d09118187c06dcf8b20a380b989def49251ec1bed294f2b306823b8506
JavaScript
1,943
56
'use strict'; { window.addEventListener('load', function(e) { function setTheme(mode) { if (mode !== "light" && mode !== "dark" && mode !== "auto") { console.error(`Got invalid theme mode: ${mode}. Resetting to auto.`); mode = "auto"; } do...
275cf582b9f89954bc8a3dc94f3af9b9a09c8244cbb5380e9fed82e4e09b9e60
JavaScript
1,949
51
/* 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 ...
d5b3be08fdf0e37193d2eab3049ba8088da5e0913a1b0091ef80a38af8a6aa55
JavaScript
1,951
61
var minimist = require('minimist') var getAbi = require('node-abi').getAbi var detectLibc = require('detect-libc') var napi = require('napi-build-utils') var env = process.env var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || '' // Get the configuration module.exports = function (pkg) { va...
8bb227a9971bbaa538b2732e1fec53a5dac300a494458a0324b9df55ab03f330
JavaScript
1,966
5
// stats.js - http://github.com/mrdoob/stats.js (function(f,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"===typeof define&&define.amd?define(e):f.Stats=e()})(this,function(){var f=function(){function e(a){c.appendChild(a.dom);return a}function u(a){for(var d=0;d<c.children.leng...
1a0fe9a75ad6f571e50e28353a5b0250e43aa5f15e4201c325b356d815f2ed7b
JavaScript
1,980
44
/* Copyright (c) 2011 Andrei Mackenzie 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, modify, merge, publish, distribute...
4a3b988ff9f16571da0cf90190d8061819b26132affffbbd1557218ec3c05397
JavaScript
1,981
5
// stats.js - http://github.com/mrdoob/stats.js var Stats=function(){function f(a,e,b){a=document.createElement(a);a.id=e;a.style.cssText=b;return a}function l(a,e,b){var c=f("div",a,"padding:0 0 3px 3px;text-align:left;background:"+b),d=f("div",a+"Text","font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight...
5f5e9821ceb587b7f8a12deaade4f64e236a5b557bda921389a2c34b0377deb1
JavaScript
1,985
63
const { Transform } = require('stream') /** * A transform stream that waits for a sequence of "ready" bytes before emitting a ready event and emitting data events * @summary To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed t...
c97c244365a9ba0a92a77b39dae0a60fc39497536fdb1c0b72aef1cf8df04f45
JavaScript
2,015
64
getJasmineRequireObj().toBeRejectedWithMatching = function(j$, private$) { 'use strict'; const usageError = private$.formatErrorMsg( '<toBeRejectedWithMatching>', 'expect(function() {<expectation>}).toBeRejectedWithMatching(<Predicate>)' ); /** * Expect a promise to be rejected with a value matchin...
a85339414dc5ad1391e73f1b3dd9613a447e475aed53a36c7ba1033509a1d357
JavaScript
2,024
92
// Example: testing Pd's [/] object // node examples/test-division.js // or node test-division.js var path = require('path'), print = require('util').print; port = require('../../port'); var dir = path.dirname(path.relative(process.cwd(), process.argv[1])); var tests = [{ input: ['cold 2', 'hot 10'], expect: 5...
71e59aeed4af10ad4268bb35e4c51fe89c640ea9a3f1a9cb597594b02376e249
JavaScript
2,043
84
'use strict' const DuplexStream = require('readable-stream').Duplex const inherits = require('inherits') const BufferList = require('./BufferList') function BufferListStream (callback) { if (!(this instanceof BufferListStream)) { return new BufferListStream(callback) } if (typeof callback === 'function') {...
8b3ad3a63761a51e9668f88198b218379294019c77d3d8344b2e2f8d89a3e0b3
JavaScript
2,059
79
'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Buffer = require('safe-buffer').Buffer; var util = require('util'); function copyBuffer(src, target, offset) { src.copy(target, offset); } mod...
db3ee6ab2fdabdffc19d5df0cf9461488329379cbb0640eb73203a35197960aa
JavaScript
2,065
121
/** * Expose `Delegator`. */ module.exports = Delegator; /** * Initialize a delegator. * * @param {Object} proto * @param {String} target * @api public */ function Delegator(proto, target) { if (!(this instanceof Delegator)) return new Delegator(proto, target); this.proto = proto; this.target = target...
40f591f84d28f940d0dd5805991d2e8843eb9d8d7c4b9fca398e057c79e6b562
JavaScript
2,070
105
var SerialRunner = require("../index.js").SerialRunner var should = require("should") describe("When running tasks sequentially", function() { it("", function(done) { var r = new SerialRunner() var list = [] var numCallback = 10 var func = function(i, next) { setTimeout(function() { li...
ee406fe80c120316adbaa4c01d3ccf9d817510fb7966384cb0786a63ca14e28c
JavaScript
2,080
74
//@UIService ui /* BARlib.js * IJ BAR: https://github.com/tferr/Scripts * * Template BAR library (http://imagej.net/BAR#BAR_lib) to be placed in BAR/lib. This file * demonstrates how functions/methods in a common file can be shared across your scripts. * To load such scripting additions, append the following to y...
9f0fe2257ab879f8a59ea1e5b0de3d5f5d8c46eb5a737fb51624158ac93dd4b5
JavaScript
2,086
75
getJasmineHtmlRequireObj().HtmlReporterV2Urls = function(j$, private$) { 'use strict'; // TODO unify with V2 UrlBuilder? /** * @class HtmlReporterV2Urls * @classdesc Processes URLs for {@link HtmlReporterV2}. * @since 6.0.0 */ class HtmlReporterV2Urls { constructor(options = {}) { // quer...
557f3f9de6a88632a6a39906b6cbf7d579a459032a9b8873885f227f0198093c
JavaScript
2,087
65
describe('toHaveBeenCalled', function() { it('passes when the actual was called, with a custom .not fail message', function() { const matcher = privateUnderTest.matchers.toHaveBeenCalled(); const calledSpy = new privateUnderTest.Spy('called-spy'); calledSpy(); const result = matcher.compare(calledSp...
4f8b0e8e9e9cff773ba540daf8a065d9b19b2ee1d108acc0172614f81b11ef0b
JavaScript
2,088
113
/*! * statuses * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. * @private */ var codes = require('./codes.json') /** * Module exports. * @public */ module.exports = status // status code to message map status.STAT...
20b2067e081fe62839b882641d446341e7c833191f0db88b92d729adcc984416
JavaScript
2,093
82
getJasmineRequireObj().toThrow = function(j$, private$) { 'use strict'; const getErrorMsg = private$.formatErrorMsg( '<toThrow>', 'expect(function() {<expectation>}).toThrow()' ); /** * {@link expect} a function to `throw` something. * @function * @name matchers#toThrow * @since 2.0.0 *...
2b4f186d8d173646f228bbb368ce2aec00398bb7038be1d5aeefa869863f6544
JavaScript
2,095
99
'use strict'; const deferToConnect = require('defer-to-connect'); module.exports = request => { const timings = { start: Date.now(), socket: null, lookup: null, connect: null, upload: null, response: null, end: null, error: null, phases: { wait: null, dns: null, tcp: null, request: null,...
c335ea757e3898080795f25093827d97b8fb00d0f3ac04dd56c80eecdac8eef3
JavaScript
2,098
76
'use strict'; const preserveCamelCase = string => { let isLastCharLower = false; let isLastCharUpper = false; let isLastLastCharUpper = false; for (let i = 0; i < string.length; i++) { const character = string[i]; if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { ...
d2e92e044bf229aa38932172f4d0dde5505b6499d013b6c8b9f73d0d3d620d1b
JavaScript
2,101
68
var assert = require('tap'); var t = require('./lib/util'); assert.equal(t.isArray([]), true); assert.equal(t.isArray({}), false); assert.equal(t.isBoolean(null), false); assert.equal(t.isBoolean(true), true); assert.equal(t.isBoolean(false), true); assert.equal(t.isNull(null), true); assert.equal(t.isNull(undefine...
0c345a6ba801f065d347aa48e77972e7d73263b457e4cfb188f64af64b5d41c2
JavaScript
2,106
79
'use strict'; const errors = require('./errors'); const asStream = require('./as-stream'); const asPromise = require('./as-promise'); const normalizeArguments = require('./normalize-arguments'); const merge = require('./merge'); const deepFreeze = require('./utils/deep-freeze'); const getPromiseOrStream = options => o...
e02cb9714ef6e561e971fe400644330212f07ca86120587199470d8b759a4b7c
JavaScript
2,108
90
/* object-assign (c) Sindre Sorhus @license MIT */ 'use strict'; /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null ...
3cba5ace4c953be1cb5348c67689242c52320882f145ae20c913f8740aedd946
JavaScript
2,109
70
describe('HtmlSpecFilterV2', function() { describe('When both query parameters are falsy', function() { it('matches everything', function() { const specFilter = new privateUnderTest.HtmlSpecFilterV2({ filterParams() { return { path: '', spec: '' }; } }); expect(specFil...
37f9716144105051ab302f6a0c30a52ff5de7269b9e1173ac22be798fc11ccad
JavaScript
2,110
77
/* eslint-disable node/no-deprecated-api */ 'use strict' var buffer = require('buffer') var Buffer = buffer.Buffer var safer = {} var key for (key in buffer) { if (!buffer.hasOwnProperty(key)) continue if (key === 'SlowBuffer' || key === 'Buffer') continue safer[key] = buffer[key] } var Safer = safer.Buffer...
6dbfb594e91ec9eaefff6c652bae9e4f4a960c0dea28c93a383c1e62ff0c6074
JavaScript
2,112
63
describe('AllOf', function() { it('matches a single value', function() { const matchersUtil = new privateUnderTest.MatchersUtil(); const allOf = new privateUnderTest.AllOf('foo'); expect(allOf.asymmetricMatch('foo', matchersUtil)).toBeTrue(); }); it('matches a single matcher', function() { const...
c12d39d33b6c341030d338a5dbef1210ba0c5cd82a468b66ec81f659d38f17d8
JavaScript
2,131
110
const EventEmitter = require("events"); const parser_v4 = require("engine.io-parser"); const parser_v3 = require("./parser-v3/index"); const debug = require("debug")("engine:transport"); /** * Noop function. * * @api private */ function noop() {} class Transport extends EventEmitter { /** * Transport constr...
c8186bf4c0ce41f141b378ff495be1c8d9122bd5f517eeb372ff06094576b2f8
JavaScript
2,131
110
const EventEmitter = require("events"); const parser_v4 = require("engine.io-parser"); const parser_v3 = require("./parser-v3/index"); const debug = require("debug")("engine:transport"); /** * Noop function. * * @api private */ function noop() {} class Transport extends EventEmitter { /** * Transport constr...
de00568682680cb5b92d70c7d0d71da5706b9c67fdd72438387e3ea7c29547dc
JavaScript
2,132
93
// run `node server.js` and browse to http://localhost:8118/ // this example requires socket.io `npm install socket.io` var path = require('path'), http = require('http'), fs = require('fs'), socketio = require('socket.io'), port = require('../../port'); var dir = path.dirname(path.relative(process.cwd(), proces...
0e492419518a1a674219f099ca9387f37ff79456bca9e8df311a0525d2d9f9eb
JavaScript
2,144
77
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$, private$) { 'use strict'; const getErrorMsg = private$.formatErrorMsg( '<toHaveBeenCalledTimes>', 'expect(<spyObj>).toHaveBeenCalledTimes(<Number>)' ); /** * {@link expect} the actual (a {@link Spy}) to have been called the specified numbe...
479d1aab266daca3daf7dfbe5a087c0234b697850ebf493e74771874919561b2
JavaScript
2,149
80
getJasmineRequireObj().toHaveSpyInteractions = function(j$, private$) { 'use strict'; const getErrorMsg = private$.formatErrorMsg( '<toHaveSpyInteractions>', 'expect(<spyObj>).toHaveSpyInteractions()' ); /** * {@link expect} the actual (a {@link SpyObj}) spies to have been called. * @function ...
1eafbe451051c4326b77efac0d182a56289aa4c7e6124807abe028c519e3b0d1
JavaScript
2,153
87
// run `node server.js` and browse to http://localhost:8118/ // this example requires socket.io `npm install socket.io` var path = require('path'), http = require('http'), fs = require('fs'), socketio = require('socket.io'), port = require('../../port'); var dir = path.dirname(path.relative(process.cwd(), process...
ce6f765f97474291660c9836e63b8ef5fb4df6ad3921d782fa45f63ae892a878
JavaScript
2,153
83
getJasmineRequireObj().toThrowMatching = function(j$, private$) { 'use strict'; const usageError = private$.formatErrorMsg( '<toThrowMatching>', 'expect(function() {<expectation>}).toThrowMatching(<Predicate>)' ); /** * {@link expect} a function to `throw` something matching a predicate. * @func...
fe3e2b20c1ebb57c3b390c8f685ad1e04e6f493517fa7e432f4351bb77a1a4d0
JavaScript
2,154
85
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ...
1bdbb2a1b5fc66a7086d29ec37a6c128797025f611f7de626e812548be60ddf2
JavaScript
2,164
65
class Material { size_rescale; // actual size startTime; // Stimulus presentation start time constructor() { let cfg = Config.Image; this.arrays_orig = cfg.arrays_orig; this.arrays_fake = cfg.arrays_fake; this.size_rescale = cfg.size_rescale; this.startTi...
67ae2811263a99206bcebb4a9b522b9d5608caa53fb7a580a05268679524ae91
JavaScript
2,165
77
describe('Custom object formatters', function() { let env; beforeEach(function() { env = new privateUnderTest.Env(); env.configure({ random: false }); }); it('scopes custom object formatters to a spec', async function() { env.it('a spec with custom pretty-printer', function() { env.addCustom...
f3d658268111d4ddbc38b1c4cc67bd49ff0418cd7b0110e0ba42b530cdf80dd6
JavaScript
2,182
92
'use strict'; var platform = require('os').platform(); var spawnSync = require('child_process').spawnSync; var readdirSync = require('fs').readdirSync; var GLIBC = 'glibc'; var MUSL = 'musl'; var spawnOptions = { encoding: 'utf8', env: process.env }; if (!spawnSync) { spawnSync = function () { return { st...
93fea1f6e69ba6c15b40e1f275a5a8e245324b676d900d5674d0ed6c92506d34
JavaScript
2,189
64
describe('ArrayWithExactContents', function() { it('matches an array with the same items in a different order', function() { const matcher = new privateUnderTest.ArrayWithExactContents(['a', 2, /a/]); const matchersUtil = new privateUnderTest.MatchersUtil(); expect(matcher.asymmetricMatch([2, 'a', /a/], ...
fb511c4c70a6cb0e2a06d03e67ca88dca9f4da6266b909c7338e453d2ecc9fdb
JavaScript
2,191
72
"use strict"; var Buffer = require("safer-buffer").Buffer; // Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that // correspond to encoded bytes (if 128 - then lower half is ASCII). exports._sbcs = SBCSCodec; function SBCSCodec(codecOptions, iconv) { if (!codecOptions) ...
d2e82495607abf54f16e21de04d90ba9ce1605451667d88425babece988f148b
JavaScript
2,192
1
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.base64js=a()}})(function(){return function(){function b...
60ae01725219c69e086e0cfe6a6da1f94a9bafcfbf528460b6e04b7b6d983165
JavaScript
2,224
82
var once = require('once') var eos = require('end-of-stream') var fs = require('fs') // we only need fs to get the ReadStream and WriteStream prototypes var noop = function () {} var ancient = /^v?\.0/.test(process.version) var isFn = function (fn) { return typeof fn === 'function' } var isFS = function (stream) {...
702ab02dc767bd351fca5f9faa659327f22f4cfd2684e0a33b23447838f5773b
JavaScript
2,229
103
/*! * depd * Copyright(c) 2014 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module exports. */ module.exports = callSiteToString /** * Format a CallSite file location to a string. */ function callSiteFileLocation (callSite) { var fileName var fileLocation = '' if (callSite.isNativ...
d00db487da2affdfe16e96c3bf5cc3d2bf7a4a93be15aa8eeb0539e494c0203e
JavaScript
2,230
85
const fs = require('fs'); const os = require('os'); const path = require('path'); const glob = require('glob'); const ejs = require('ejs'); const archiver = require('archiver'); const buildDistribution = require('./lib/buildDistribution'); const prefix = path.join(os.tmpdir(), 'jasmine-build-standalone'); const tmpDir...
d283f1b8c7f9862419941b4c25dd173e3366623e1a5c570f8cf9043a3eb3f2d8
JavaScript
2,239
87
getJasmineHtmlRequireObj().QueryString = function() { 'use strict'; /** * Reads and manipulates the query string. * @since 2.0.0 */ class QueryString { #getWindowLocation; /** * @param options Object with a getWindowLocation property, which should be * a function returning the current...
5f1420af4a106eaa68ed7b4bb5e46f47e0f251169e38841ec8262447e4691b5d
JavaScript
2,257
97
const conversions = require('./conversions'); /* This function routes a model to all other models. all functions that are routed have a property `.conversion` attached to the returned synthetic function. This property is an array of strings, each with the steps in between the 'from' and 'to' color models (inclus...
058c948a7f945b3693cacd4389f398a459a2c5540025712b1242fb0e967be34a
JavaScript
2,271
83
describe('Any', function() { it('matches a string', function() { const any = new privateUnderTest.Any(String); expect(any.asymmetricMatch('foo')).toBe(true); }); it('matches a number', function() { const any = new privateUnderTest.Any(Number); expect(any.asymmetricMatch(1)).toBe(true); }); ...
a423a3cf6f6f8f2a8ba5ddc92f4de5f62ac514ca8754d3f8bb58e87df9234e15
JavaScript
2,275
116
const Transport = require("../transport"); const debug = require("debug")("engine:ws"); class WebSocket extends Transport { /** * WebSocket transport * * @param {http.IncomingMessage} * @api public */ constructor(req) { super(req); this.socket = req.websocket; this.socket.on("message", t...
167d1772fe5408a58603790e34a76faa5b774605bedc989e169eab1f7502208f
JavaScript
2,278
78
#!/usr/bin/env node var path = require('path') var fs = require('fs') 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 asset = require('./asset') var util = require(...
54a6e8ef720b06a300b21f6c60387805dec743a64154784a609dfe8c6860776a
JavaScript
2,285
121
/*! * body-parser * Copyright(c) 2014-2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. */ var bytes = require('bytes') var contentType = require('content-type') var debug = require('debug')('body-parser:text') var read = require('../read') var typeis = require('type-is'...
2e33ad03d115f05e4eddb3cea4ecb1042346c5aeeabbdc68c1d19e414609ba76
JavaScript
2,292
79
getJasmineRequireObj().SpyFactory = function(j$, private$) { 'use strict'; function SpyFactory( getCustomStrategies, getDefaultStrategyFn, getMatchersUtil ) { this.createSpy = function(name, originalFn) { if (private$.isFunction(name) && originalFn === undefined) { originalFn = name...
2f0043d0ff0844eb0f38f49f97d4071f0bc8262266d34337556c415bf222dad4
JavaScript
2,295
103
'use strict'; const EventEmitter = require('events'); const JSONB = require('json-buffer'); const loadStore = opts => { const adapters = { redis: '@keyv/redis', mongodb: '@keyv/mongo', mongo: '@keyv/mongo', sqlite: '@keyv/sqlite', postgresql: '@keyv/postgres', postgres: '@keyv/postgres', mysql: '@keyv/...