repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/underscore.js | modules/underscore.js | import { VERSION } from './_setup.js';
// If Underscore is called as a function, it returns a wrapped object that can
// be used OO-style. This wrapper holds altered versions of all functions added
// through `_.mixin`. Wrapped objects may be chained.
export default function _(obj) {
if (obj instanceof _) return obj... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/templateSettings.js | modules/templateSettings.js | import _ from './underscore.js';
// By default, Underscore uses ERB-style template delimiters. Change the
// following template settings to use alternative delimiters.
export default _.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
};
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/now.js | modules/now.js | // A (possibly faster) way to get the current timestamp as an integer.
export default Date.now || function() {
return new Date().getTime();
};
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/difference.js | modules/difference.js | import restArguments from './restArguments.js';
import flatten from './_flatten.js';
import filter from './filter.js';
import contains from './contains.js';
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
export default restArgume... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isFinite.js | modules/isFinite.js | import { _isFinite } from './_setup.js';
import isSymbol from './isSymbol.js';
// Is a given object a finite number?
export default function isFinite(obj) {
return !isSymbol(obj) && _isFinite(obj) && !isNaN(parseFloat(obj));
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/defaults.js | modules/defaults.js | import createAssigner from './_createAssigner.js';
import allKeys from './allKeys.js';
// Fill in a given object with default properties.
export default createAssigner(allKeys, true);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_setup.js | modules/_setup.js | // Current version.
export var VERSION = '1.13.7';
// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
// instead of `window` for `WebWorker` support.
export var root = (typeof self == 'object' && self.self === self && self) ||
... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_hasObjectTag.js | modules/_hasObjectTag.js | import tagTester from './_tagTester.js';
export default tagTester('Object');
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_methodFingerprint.js | modules/_methodFingerprint.js | import getLength from './_getLength.js';
import isFunction from './isFunction.js';
import allKeys from './allKeys.js';
// Since the regular `Object.prototype.toString` type tests don't work for
// some types in IE 11, we use a fingerprinting heuristic instead, based
// on the methods. It's not great, but it's the best... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/pairs.js | modules/pairs.js | import keys from './keys.js';
// Convert an object into a list of `[key, value]` pairs.
// The opposite of `_.object` with one argument.
export default function pairs(obj) {
var _keys = keys(obj);
var length = _keys.length;
var pairs = Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [_keys[i],... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/throttle.js | modules/throttle.js | import now from './now.js';
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leadin... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isWeakSet.js | modules/isWeakSet.js | import tagTester from './_tagTester.js';
export default tagTester('WeakSet');
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/extendOwn.js | modules/extendOwn.js | import createAssigner from './_createAssigner.js';
import keys from './keys.js';
// Assigns a given object with all the own properties in the passed-in
// object(s).
// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
export default createAssigner(keys);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_group.js | modules/_group.js | import cb from './_cb.js';
import each from './each.js';
// An internal function used for aggregate "group by" operations.
export default function group(behavior, partition) {
return function(obj, iteratee, context) {
var result = partition ? [[], []] : {};
iteratee = cb(iteratee, context);
each(obj, fun... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/each.js | modules/each.js | import optimizeCb from './_optimizeCb.js';
import isArrayLike from './_isArrayLike.js';
import keys from './keys.js';
// The cornerstone for collection functions, an `each`
// implementation, aka `forEach`.
// Handles raw objects in addition to array-likes. Treats all
// sparse array-likes as if they were dense.
expor... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isUndefined.js | modules/isUndefined.js | // Is a given variable undefined?
export default function isUndefined(obj) {
return obj === void 0;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_cb.js | modules/_cb.js | import _ from './underscore.js';
import baseIteratee from './_baseIteratee.js';
import iteratee from './iteratee.js';
// The function we call internally to generate a callback. It invokes
// `_.iteratee` if overridden, otherwise `baseIteratee`.
export default function cb(value, context, argCount) {
if (_.iteratee !=... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_createAssigner.js | modules/_createAssigner.js | // An internal function for creating assigner functions.
export default function createAssigner(keysFunc, defaults) {
return function(obj) {
var length = arguments.length;
if (defaults) obj = Object(obj);
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
v... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/uniqueId.js | modules/uniqueId.js | // Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
export default function uniqueId(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isWeakMap.js | modules/isWeakMap.js | import tagTester from './_tagTester.js';
import { isIE11 } from './_stringTagBug.js';
import { ie11fingerprint, weakMapMethods } from './_methodFingerprint.js';
export default isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap');
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isArguments.js | modules/isArguments.js | import tagTester from './_tagTester.js';
import has from './_has.js';
var isArguments = tagTester('Arguments');
// Define a fallback version of the method in browsers (ahem, IE < 9), where
// there isn't any inspectable "Arguments" type.
(function() {
if (!isArguments(arguments)) {
isArguments = function(obj) {... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/find.js | modules/find.js | import isArrayLike from './_isArrayLike.js';
import findIndex from './findIndex.js';
import findKey from './findKey.js';
// Return the first value which passes a truth test.
export default function find(obj, predicate, context) {
var keyFinder = isArrayLike(obj) ? findIndex : findKey;
var key = keyFinder(obj, pred... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/defer.js | modules/defer.js | import partial from './partial.js';
import delay from './delay.js';
import _ from './underscore.js';
// Defers a function, scheduling it to run after the current call stack has
// cleared.
export default partial(delay, _, 1);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/rest.js | modules/rest.js | import { slice } from './_setup.js';
// Returns everything but the first entry of the `array`. Especially useful on
// the `arguments` object. Passing an **n** will return the rest N values in the
// `array`.
export default function rest(array, n, guard) {
return slice.call(array, n == null || guard ? 1 : n);
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/size.js | modules/size.js | import isArrayLike from './_isArrayLike.js';
import keys from './keys.js';
// Return the number of elements in a collection.
export default function size(obj) {
if (obj == null) return 0;
return isArrayLike(obj) ? obj.length : keys(obj).length;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_createReduce.js | modules/_createReduce.js | import isArrayLike from './_isArrayLike.js';
import keys from './keys.js';
import optimizeCb from './_optimizeCb.js';
// Internal helper to create a reducing function, iterating left or right.
export default function createReduce(dir) {
// Wrap code that reassigns argument variables in a separate function than
// ... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_escapeMap.js | modules/_escapeMap.js | // Internal list of HTML entities for escaping.
export default {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'`': '`'
};
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/omit.js | modules/omit.js | import restArguments from './restArguments.js';
import isFunction from './isFunction.js';
import negate from './negate.js';
import map from './map.js';
import flatten from './_flatten.js';
import contains from './contains.js';
import pick from './pick.js';
// Return a copy of the object without the disallowed properti... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/create.js | modules/create.js | import baseCreate from './_baseCreate.js';
import extendOwn from './extendOwn.js';
// Creates an object that inherits from the given prototype object.
// If additional properties are provided then they will be added to the
// created object.
export default function create(prototype, props) {
var result = baseCreate(... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_shallowProperty.js | modules/_shallowProperty.js | // Internal helper to generate a function to obtain property `key` from `obj`.
export default function shallowProperty(key) {
return function(obj) {
return obj == null ? void 0 : obj[key];
};
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isBoolean.js | modules/isBoolean.js | import { toString } from './_setup.js';
// Is a given value a boolean?
export default function isBoolean(obj) {
return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/indexBy.js | modules/indexBy.js | import group from './_group.js';
// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
// when you know that your index values will be unique.
export default group(function(result, value, key) {
result[key] = value;
});
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_createPredicateIndexFinder.js | modules/_createPredicateIndexFinder.js | import cb from './_cb.js';
import getLength from './_getLength.js';
// Internal function to generate `_.findIndex` and `_.findLastIndex`.
export default function createPredicateIndexFinder(dir) {
return function(array, predicate, context) {
predicate = cb(predicate, context);
var length = getLength(array);
... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/lastIndexOf.js | modules/lastIndexOf.js | import findLastIndex from './findLastIndex.js';
import createIndexFinder from './_createIndexFinder.js';
// Return the position of the last occurrence of an item in an array,
// or -1 if the item is not included in the array.
export default createIndexFinder(-1, findLastIndex);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_createEscaper.js | modules/_createEscaper.js | import keys from './keys.js';
// Internal helper to generate functions for escaping and unescaping strings
// to/from HTML interpolation.
export default function createEscaper(map) {
var escaper = function(match) {
return map[match];
};
// Regexes for identifying a key that needs to be escaped.
var source ... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_baseCreate.js | modules/_baseCreate.js | import isObject from './isObject.js';
import { nativeCreate } from './_setup.js';
// Create a naked function reference for surrogate-prototype-swapping.
function ctor() {
return function(){};
}
// An internal function for creating a new object that inherits from another.
export default function baseCreate(prototype... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_collectNonEnumProps.js | modules/_collectNonEnumProps.js | import { nonEnumerableProps, ObjProto } from './_setup.js';
import isFunction from './isFunction.js';
import has from './_has.js';
// Internal helper to create a simple lookup structure.
// `collectNonEnumProps` used to depend on `_.contains`, but this led to
// circular imports. `emulatedSet` is a one-off solution th... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/min.js | modules/min.js | import isArrayLike from './_isArrayLike.js';
import values from './values.js';
import cb from './_cb.js';
import each from './each.js';
// Return the minimum element (or element-based computation).
export default function min(obj, iteratee, context) {
var result = Infinity, lastComputed = Infinity,
value, comp... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/union.js | modules/union.js | import restArguments from './restArguments.js';
import uniq from './uniq.js';
import flatten from './_flatten.js';
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
export default restArguments(function(arrays) {
return uniq(flatten(arrays, true, true));
});
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_getLength.js | modules/_getLength.js | import shallowProperty from './_shallowProperty.js';
// Internal helper to obtain the `length` property of an object.
export default shallowProperty('length');
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/extend.js | modules/extend.js | import createAssigner from './_createAssigner.js';
import allKeys from './allKeys.js';
// Extend a given object with all the properties in passed-in object(s).
export default createAssigner(allKeys);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/pluck.js | modules/pluck.js | import map from './map.js';
import property from './property.js';
// Convenience version of a common use case of `_.map`: fetching a property.
export default function pluck(obj, key) {
return map(obj, property(key));
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/sortedIndex.js | modules/sortedIndex.js | import cb from './_cb.js';
import getLength from './_getLength.js';
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
export default function sortedIndex(array, obj, iteratee, context) {
iteratee = cb(iteratee, context,... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/groupBy.js | modules/groupBy.js | import group from './_group.js';
import has from './_has.js';
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
export default group(function(result, value, key) {
if (has(result, key)) result[key].push(value); else result[key] = [v... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/findIndex.js | modules/findIndex.js | import createPredicateIndexFinder from './_createPredicateIndexFinder.js';
// Returns the first index on an array-like that passes a truth test.
export default createPredicateIndexFinder(1);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isElement.js | modules/isElement.js | // Is a given value a DOM element?
export default function isElement(obj) {
return !!(obj && obj.nodeType === 1);
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/matcher.js | modules/matcher.js | import extendOwn from './extendOwn.js';
import isMatch from './isMatch.js';
// Returns a predicate for checking whether an object has a given set of
// `key:value` pairs.
export default function matcher(attrs) {
attrs = extendOwn({}, attrs);
return function(obj) {
return isMatch(obj, attrs);
};
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isDataView.js | modules/isDataView.js | import tagTester from './_tagTester.js';
import isFunction from './isFunction.js';
import isArrayBuffer from './isArrayBuffer.js';
import { hasDataViewBug } from './_stringTagBug.js';
var isDataView = tagTester('DataView');
// In IE 10 - Edge 13, we need a different heuristic
// to determine whether an object is a `D... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isTypedArray.js | modules/isTypedArray.js | import { supportsArrayBuffer, nativeIsView, toString } from './_setup.js';
import isDataView from './isDataView.js';
import constant from './constant.js';
import isBufferLike from './_isBufferLike.js';
// Is a given value a typed array?
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_flatten.js | modules/_flatten.js | import getLength from './_getLength.js';
import isArrayLike from './_isArrayLike.js';
import isArray from './isArray.js';
import isArguments from './isArguments.js';
// Internal implementation of a recursive `flatten` function.
export default function flatten(input, depth, strict, output) {
output = output || [];
... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_chainResult.js | modules/_chainResult.js | import _ from './underscore.js';
// Helper function to continue chaining intermediate results.
export default function chainResult(instance, obj) {
return instance._chain ? _(obj).chain() : obj;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_keyInObj.js | modules/_keyInObj.js | // Internal `_.pick` helper function to determine whether `key` is an enumerable
// property name of `obj`.
export default function keyInObj(value, key, obj) {
return key in obj;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/first.js | modules/first.js | import initial from './initial.js';
// Get the first element of an array. Passing **n** will return the first N
// values in the array. The **guard** check allows it to work with `_.map`.
export default function first(array, n, guard) {
if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/functions.js | modules/functions.js | import isFunction from './isFunction.js';
// Return a sorted list of the function names available on the object.
export default function functions(obj) {
var names = [];
for (var key in obj) {
if (isFunction(obj[key])) names.push(key);
}
return names.sort();
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/shuffle.js | modules/shuffle.js | import sample from './sample.js';
// Shuffle a collection.
export default function shuffle(obj) {
return sample(obj, Infinity);
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/values.js | modules/values.js | import keys from './keys.js';
// Retrieve the values of an object's properties.
export default function values(obj) {
var _keys = keys(obj);
var length = _keys.length;
var values = Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[_keys[i]];
}
return values;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/index-all.js | modules/index-all.js | // ESM Exports
// ===========
// This module is the package entry point for ES module users. In other words,
// it is the module they are interfacing with when they import from the whole
// package instead of from a submodule, like this:
//
// ```js
// import { map } from 'underscore';
// ```
//
// The difference with ... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/before.js | modules/before.js | // Returns a function that will only be executed up to (but not including) the
// Nth call.
export default function before(times, func) {
var memo;
return function() {
if (--times > 0) {
memo = func.apply(this, arguments);
}
if (times <= 1) func = null;
return memo;
};
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/random.js | modules/random.js | // Return a random integer between `min` and `max` (inclusive).
export default function random(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/flatten.js | modules/flatten.js | import _flatten from './_flatten.js';
// Flatten out an array, either recursively (by default), or up to `depth`.
// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
export default function flatten(array, depth) {
return _flatten(array, depth, false);
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/isEmpty.js | modules/isEmpty.js | import getLength from './_getLength.js';
import isArray from './isArray.js';
import isString from './isString.js';
import isArguments from './isArguments.js';
import keys from './keys.js';
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
export default function isEmp... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/partition.js | modules/partition.js | import group from './_group.js';
// Split a collection into two arrays: one whose elements all pass the given
// truth test, and one whose elements all do not pass the truth test.
export default group(function(result, value, pass) {
result[pass ? 0 : 1].push(value);
}, true);
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/invert.js | modules/invert.js | import keys from './keys.js';
// Invert the keys and values of an object. The values must be serializable.
export default function invert(obj) {
var result = {};
var _keys = keys(obj);
for (var i = 0, length = _keys.length; i < length; i++) {
result[obj[_keys[i]]] = _keys[i];
}
return result;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/contains.js | modules/contains.js | import isArrayLike from './_isArrayLike.js';
import values from './values.js';
import indexOf from './indexOf.js';
// Determine if the array or object contains a given item (using `===`).
export default function contains(obj, item, fromIndex, guard) {
if (!isArrayLike(obj)) obj = values(obj);
if (typeof fromIndex ... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/bind.js | modules/bind.js | import restArguments from './restArguments.js';
import isFunction from './isFunction.js';
import executeBound from './_executeBound.js';
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally).
export default restArguments(function(func, context, args) {
if (!isFunction(func)) t... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_isArrayLike.js | modules/_isArrayLike.js | import createSizePropertyCheck from './_createSizePropertyCheck.js';
import getLength from './_getLength.js';
// Internal helper for collection methods to determine whether a collection
// should be iterated as an array or as an object.
// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
// ... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_createIndexFinder.js | modules/_createIndexFinder.js | import getLength from './_getLength.js';
import { slice } from './_setup.js';
import isNaN from './isNaN.js';
// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
export default function createIndexFinder(dir, predicateFind, sortedIndex) {
return function(array, item, idx) {
var i = 0,... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/_deepGet.js | modules/_deepGet.js | // Internal function to obtain a nested property in `obj` along `path`.
export default function deepGet(obj, path) {
var length = path.length;
for (var i = 0; i < length; i++) {
if (obj == null) return void 0;
obj = obj[path[i]];
}
return length ? obj : void 0;
}
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/modules/get.js | modules/get.js | import toPath from './_toPath.js';
import deepGet from './_deepGet.js';
import isUndefined from './isUndefined.js';
// Get the value of the (deep) property on `path` from `object`.
// If any property in `path` does not exist or if the value is
// `undefined`, return `defaultValue` instead.
// The `path` is normalized ... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test-treeshake/template.js | test-treeshake/template.js | export { template } from '../modules/index-all.js';
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test-treeshake/map.js | test-treeshake/map.js | export { default as map } from '../modules/map.js';
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test-treeshake/rollup.config.js | test-treeshake/rollup.config.js | module.exports = [{
input: 'map.js',
output: {
file: 'map-umd.js',
format: 'umd',
name: 'map',
},
}, {
input: 'template.js',
output: {
file: 'template-umd.js',
format: 'umd',
name: 'template',
},
}];
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/gulpfile.js | gulpfile.js | // ==========================================================================
// Gulp build script
// ==========================================================================
export { default } from './tasks/build.js';
export * from './tasks/build.js';
export * from './tasks/deploy.js';
| javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/tasks/build.js | tasks/build.js | import { readFileSync } from 'node:fs';
import path, { join } from 'node:path';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import autoprefixer from 'autoprefixer';
import browserSync from 'browser-sync';
import cssnano fro... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/tasks/deploy.js | tasks/deploy.js | import { readFileSync } from 'node:fs';
import path, { join } from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { S3Client } from '@aws-sdk/client-s3';
import aws from 'aws-sdk';
import { bold, cyan, green } from 'colorette';
import log from 'fancy-log';
import gitbr... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/tasks/utils/publish.js | tasks/utils/publish.js | import { PutObjectCommand } from '@aws-sdk/client-s3';
import mime from 'mime';
import through from 'through2';
export function publish(client, bucket, headers = {}) {
return through.obj(async function (file, _, callback) {
if (!file.isBuffer()) return callback(null, file);
// Use the relative path as the k... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/source.js | src/js/source.js | // ==========================================================================
// Plyr source update
// ==========================================================================
import { providers } from './config/types';
import html5 from './html5';
import media from './media';
import PreviewThumbnails from './plugin... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/controls.js | src/js/controls.js | // ==========================================================================
// Plyr controls
// TODO: This needs to be split into smaller files and cleaned up
// ==========================================================================
import RangeTouch from 'rangetouch';
import captions from './captions';
import ... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | true |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/storage.js | src/js/storage.js | // ==========================================================================
// Plyr storage
// ==========================================================================
import is from './utils/is';
import { extend } from './utils/objects';
class Storage {
constructor(player) {
this.enabled = player.config.st... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/html5.js | src/js/html5.js | // ==========================================================================
// Plyr HTML5 helpers
// ==========================================================================
import support from './support';
import { removeElement } from './utils/elements';
import { triggerEvent } from './utils/events';
import is f... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/support.js | src/js/support.js | // ==========================================================================
// Plyr support checks
// ==========================================================================
import { transitionEndEvent } from './utils/animation';
import { createElement } from './utils/elements';
import is from './utils/is';
// D... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/listeners.js | src/js/listeners.js | // ==========================================================================
// Plyr Event Listeners
// ==========================================================================
import controls from './controls';
import ui from './ui';
import { repaint } from './utils/animation';
import browser from './utils/browser... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/plyr.polyfilled.js | src/js/plyr.polyfilled.js | // ==========================================================================
// Plyr Polyfilled Build
// plyr.js v3.8.4
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================
import Plyr from './plyr';
import 'custom-event-po... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/console.js | src/js/console.js | // ==========================================================================
// Console wrapper
// ==========================================================================
function noop() {}
export default class Console {
constructor(enabled = false) {
this.enabled = window.console && enabled;
if (this.... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/ui.js | src/js/ui.js | // ==========================================================================
// Plyr UI
// ==========================================================================
import captions from './captions';
import controls from './controls';
import support from './support';
import { getElement, toggleClass } from './utils/... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/fullscreen.js | src/js/fullscreen.js | // ==========================================================================
// Fullscreen wrapper
// https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API#prefixing
// https://webkit.org/blog/7929/designing-websites-for-iphone-x/
// ==========================================================================
... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/plyr.js | src/js/plyr.js | // ==========================================================================
// Plyr
// plyr.js v3.8.4
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================
import captions from './captions';
import defaults from './config/d... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/media.js | src/js/media.js | // ==========================================================================
// Plyr Media
// ==========================================================================
import html5 from './html5';
import vimeo from './plugins/vimeo';
import youtube from './plugins/youtube';
import { createElement, toggleClass, wrap ... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/captions.js | src/js/captions.js | // ==========================================================================
// Plyr Captions
// TODO: Create as class
// ==========================================================================
import controls from './controls';
import support from './support';
import { dedupe } from './utils/arrays';
import brows... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/fetch.js | src/js/utils/fetch.js | // ==========================================================================
// Fetch wrapper
// Using XHR to avoid issues with older browsers
// ==========================================================================
export default function fetch(url, responseType = 'text', withCredentials = false) {
return new... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/load-script.js | src/js/utils/load-script.js | // ==========================================================================
// Load an external script
// ==========================================================================
import loadjs from 'loadjs';
export default function loadScript(url) {
return new Promise((resolve, reject) => {
loadjs(url, {
... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/strings.js | src/js/utils/strings.js | // ==========================================================================
// String utils
// ==========================================================================
import is from './is';
// Generate a random ID
export function generateId(prefix) {
return `${prefix}-${Math.floor(Math.random() * 10000)}`;
}
... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/style.js | src/js/utils/style.js | // ==========================================================================
// Style utils
// ==========================================================================
import { closest } from './arrays';
import is from './is';
// Check support for a CSS declaration
export function supportsCSS(declaration) {
if (... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/browser.js | src/js/utils/browser.js | // ==========================================================================
// Browser sniffing
// Unfortunately, due to mixed support, UA sniffing is required
// ==========================================================================
const isIE = Boolean(window.document.documentMode);
const isEdge = /Edge/.test(... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/numbers.js | src/js/utils/numbers.js | /**
* Returns a number whose value is limited to the given range.
*
* Example: limit the output of this computation to between 0 and 255
* (x * 255).clamp(0, 255)
*
* @param {number} input
* @param {number} min The lower boundary of the output range
* @param {number} max The upper boundary of the output range
... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/events.js | src/js/utils/events.js | // ==========================================================================
// Event utils
// ==========================================================================
import is from './is';
// Check for passive event listener support
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
// ht... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/i18n.js | src/js/utils/i18n.js | // ==========================================================================
// Plyr internationalization
// ==========================================================================
import is from './is';
import { getDeep } from './objects';
import { replaceAll } from './strings';
// Skip i18n for abbreviations an... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/is.js | src/js/utils/is.js | // ==========================================================================
// Type checking utils
// ==========================================================================
const getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null);
const instanceOf = (input, cons... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/promise.js | src/js/utils/promise.js | import is from './is';
/**
* Silence a Promise-like object.
* This is useful for avoiding non-harmful, but potentially confusing "uncaught
* play promise" rejection error messages.
* @param {object} value An object that may or may not be `Promise`-like.
*/
export function silencePromise(value) {
if (is.promise(... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
sampotts/plyr | https://github.com/sampotts/plyr/blob/6520022413161d06e61d396810f48cac551fa7b5/src/js/utils/load-image.js | src/js/utils/load-image.js | // ==========================================================================
// Load image avoiding xhr/fetch CORS issues
// Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded
// By default it checks if it is at least 1px, but you can add a second a... | javascript | MIT | 6520022413161d06e61d396810f48cac551fa7b5 | 2026-01-04T15:01:53.200247Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.