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 |
|---|---|---|---|---|---|---|---|---|
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/fixtures/controller.polarArea/pointLabels/withTitle/right-centered-45.js | test/fixtures/controller.polarArea/pointLabels/withTitle/right-centered-45.js | module.exports = {
config: {
type: 'polarArea',
data: {
datasets: [{
data: [1, 2, 3, 4],
backgroundColor: ['#f003', '#0f03', '#00f3', '#0003']
}],
labels: [['label 1', 'line 2'], ['label 2', 'line 2'], ['label 3', 'line 2'], ['label 4', 'line 2']]
},
options: {
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/fixtures/controller.polarArea/pointLabels/withTitle/bottom-centered-45.js | test/fixtures/controller.polarArea/pointLabels/withTitle/bottom-centered-45.js | module.exports = {
config: {
type: 'polarArea',
data: {
datasets: [{
data: [1, 2, 3, 4],
backgroundColor: ['#f003', '#0f03', '#00f3', '#0003']
}],
labels: [['label 1', 'line 2'], ['label 2', 'line 2'], ['label 3', 'line 2'], ['label 4', 'line 2']]
},
options: {
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/types/autogen.js | test/types/autogen.js | import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
import * as helpers from '../../dist/helpers.js';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
let fd;
try {
const fn = path.resolve(__dirname, 'autogen_helpers.ts');
fd = fs.openSync(fn, 'w+');
fs.w... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.colors.tests.js | test/specs/plugin.colors.tests.js | describe('Plugin.colors', () => {
describe('auto', jasmine.fixture.specs('plugin.colors'));
describe('Plugin.colors.chartDefaults', () => {
beforeAll(() => {
Chart.defaults.backgroundColor = ['green', 'yellow'];
});
afterAll(() => {
Chart.defaults.backgroundColor = 'rgba(0,0,0,0.1)';
}... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.helpers.tests.js | test/specs/core.helpers.tests.js | describe('Core helper tests', function() {
var helpers;
beforeAll(function() {
helpers = window.Chart.helpers;
});
it('should generate integer ids', function() {
var uid = helpers.uid();
expect(uid).toEqual(jasmine.any(Number));
expect(helpers.uid()).toBe(uid + 1);
expect(helpers.uid()).t... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.controller.tests.js | test/specs/core.controller.tests.js | describe('Chart', function() {
const overrides = Chart.overrides;
// https://github.com/chartjs/Chart.js/issues/2481
// See global.deprecations.tests.js for backward compatibility
it('should be defined and prototype of chart instances', function() {
var chart = acquireChart({});
expect(Chart).toBeDefi... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | true |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.subtitle.tests.js | test/specs/plugin.subtitle.tests.js | describe('plugin.subtitle', function() {
describe('auto', jasmine.fixture.specs('plugin.subtitle'));
});
| javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.radar.tests.js | test/specs/controller.radar.tests.js | describe('Chart.controllers.radar', function() {
describe('auto', jasmine.fixture.specs('controller.radar'));
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.radar).toBe('function');
});
it('Should be constructed', function() {
var chart = window.acquireCh... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/scale.linear.tests.js | test/specs/scale.linear.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
describe('Linear Scale', function() {
describe('auto', jasmine.fixture.specs('scale.linear'));
it('Should register the constructor with the registry', function() {
var Constructor = Chart.registry.getScale('linear');
expect(Constructor)... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | true |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.plugin.tests.js | test/specs/core.plugin.tests.js | describe('Chart.plugins', function() {
describe('Chart.notifyPlugins', function() {
it('should call inline plugins with arguments', function() {
var plugin = {hook: function() {}};
var chart = window.acquireChart({
plugins: [plugin]
});
var args = {value: 42};
spyOn(plugin, ... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/global.defaults.tests.js | test/specs/global.defaults.tests.js | describe('Default Configs', function() {
describe('Doughnut Chart', function() {
it('should return correct legend label objects', function() {
var chart = window.acquireChart({
type: 'doughnut',
data: {
labels: ['label1', 'label2', 'label3'],
datasets: [{
data... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.easing.tests.js | test/specs/helpers.easing.tests.js | 'use strict';
describe('Chart.helpers.easingEffects', function() {
var helpers = Chart.helpers;
describe('effects', function() {
var expected = {
easeInOutBack: [-0, -0.03751855, -0.09255566, -0.07883348, 0.08992579, 0.5, 0.91007421, 1.07883348, 1.09255566, 1.03751855, 1],
easeInOutBounce: [0, 0.0... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.scale.tests.js | test/specs/core.scale.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
describe('Core.scale', function() {
describe('auto', jasmine.fixture.specs('core.scale'));
it('should provide default scale label options', function() {
expect(Chart.defaults.scale.title).toEqual({
color: Chart.defaults.color,
d... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/element.point.tests.js | test/specs/element.point.tests.js | describe('Chart.elements.PointElement', function() {
describe('auto', jasmine.fixture.specs('element.point'));
it ('Should correctly identify as in range', function() {
// Mock out the point as if we were made by the controller
var point = new Chart.elements.PointElement({
options: {
radius: ... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.animations.tests.js | test/specs/core.animations.tests.js | describe('Chart.animations', function() {
it('should override property collection with property', function() {
const chart = {};
const anims = new Chart.Animations(chart, {
collection1: {
properties: ['property1', 'property2'],
duration: 1000
},
property2: {
duration:... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/mixed.tests.js | test/specs/mixed.tests.js | describe('Mixed charts', function() {
describe('auto', jasmine.fixture.specs('mixed'));
it('shoud be constructed with doughnuts chart', function() {
const chart = window.acquireChart({
data: {
datasets: [{
type: 'line',
data: [10, 20, 30, 40],
}, {
type: 'dou... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.datasetController.tests.js | test/specs/core.datasetController.tests.js | describe('Chart.DatasetController', function() {
describe('auto', jasmine.fixture.specs('core.datasetController'));
it('should listen for dataset data insertions or removals', function() {
var data = [0, 1, 2, 3, 4, 5];
var chart = acquireChart({
type: 'line',
data: {
datasets: [{
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | true |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.interpolation.tests.js | test/specs/helpers.interpolation.tests.js | const {_pointInLine, _steppedInterpolation, _bezierInterpolation} = Chart.helpers;
describe('helpers.interpolation', function() {
it('Should interpolate a point in line', function() {
expect(_pointInLine({x: 10, y: 10}, {x: 20, y: 20}, 0)).toEqual({x: 10, y: 10});
expect(_pointInLine({x: 10, y: 10}, {x: 20, ... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.bar.tests.js | test/specs/controller.bar.tests.js | describe('Chart.controllers.bar', function() {
describe('auto', jasmine.fixture.specs('controller.bar'));
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.bar).toBe('function');
});
it('should be constructed', function() {
var chart = window.acquireChart({
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | true |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.doughnut.tests.js | test/specs/controller.doughnut.tests.js | describe('Chart.controllers.doughnut', function() {
describe('auto', jasmine.fixture.specs('controller.doughnut'));
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.doughnut).toBe('function');
expect(typeof Chart.controllers.pie).toBe('function');
});
it('s... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.registry.tests.js | test/specs/core.registry.tests.js | describe('Chart.registry', function() {
it('should handle an ES6 controller extension', function() {
class CustomController extends Chart.DatasetController {}
CustomController.id = 'custom';
CustomController.defaults = {
foo: 'bar'
};
CustomController.overrides = {
bar: 'foo'
};
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.decimation.tests.js | test/specs/plugin.decimation.tests.js | describe('Plugin.decimation', function() {
describe('auto', jasmine.fixture.specs('plugin.decimation'));
describe('lttb', function() {
const originalData = [
{x: 0, y: 0},
{x: 1, y: 1},
{x: 2, y: 2},
{x: 3, y: 3},
{x: 4, y: 4},
{x: 5, y: 5},
{x: 6, y: 6},
{x: 7,... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.color.tests.js | test/specs/helpers.color.tests.js | const {color, getHoverColor} = Chart.helpers;
describe('Color helper', function() {
function isColorInstance(obj) {
return typeof obj === 'object' && obj.valid;
}
it('should return a color when called with a color', function() {
expect(isColorInstance(color('rgb(1, 2, 3)'))).toBe(true);
});
});
descr... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.config.tests.js | test/specs/helpers.config.tests.js | describe('Chart.helpers.config', function() {
const {getHoverColor, _createResolver, _attachContext} = Chart.helpers;
describe('_createResolver', function() {
it('should resolve to raw values', function() {
const defaults = {
color: 'red',
backgroundColor: 'green',
hoverColor: (ct... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/element.arc.tests.js | test/specs/element.arc.tests.js | // Test the rectangle element
describe('Arc element tests', function() {
it ('should determine if in range', function() {
// Mock out the arc as if the controller put it there
var arc = new Chart.elements.ArcElement({
startAngle: 0,
endAngle: Math.PI / 2,
x: 0,
y: 0,
innerRadius... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/scale.logarithmic.tests.js | test/specs/scale.logarithmic.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
describe('Logarithmic Scale tests', function() {
describe('auto', jasmine.fixture.specs('scale.logarithmic'));
it('should register', function() {
var Constructor = Chart.registry.getScale('logarithmic');
expect(Constructor).not.toBe(und... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.line.tests.js | test/specs/controller.line.tests.js | describe('Chart.controllers.line', function() {
describe('auto', jasmine.fixture.specs('controller.line'));
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.line).toBe('function');
});
it('should be constructed', function() {
var chart = window.acquireChart... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/scale.radialLinear.tests.js | test/specs/scale.radialLinear.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
// Tests for the radial linear scale used by the polar area and radar charts
describe('Test the radial linear scale', function() {
describe('auto', jasmine.fixture.specs('scale.radialLinear'));
it('Should register the constructor with the regis... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.animator.tests.js | test/specs/core.animator.tests.js | describe('Chart.animator', function() {
it('should fire onProgress for each draw', function(done) {
let count = 0;
let drawCount = 0;
const progress = (animation) => {
count++;
expect(animation.numSteps).toEqual(250);
expect(animation.currentStep <= 250).toBeTrue();
};
acquireCha... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.bubble.tests.js | test/specs/controller.bubble.tests.js | describe('Chart.controllers.bubble', function() {
describe('auto', jasmine.fixture.specs('controller.bubble'));
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.bubble).toBe('function');
});
it('should be constructed', function() {
var chart = window.acquir... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/scale.time.tests.js | test/specs/scale.time.tests.js | // Time scale tests
describe('Time scale tests', function() {
describe('auto', jasmine.fixture.specs('scale.time'));
function createScale(data, options, dimensions) {
var width = (dimensions && dimensions.width) || 400;
var height = (dimensions && dimensions.height) || 50;
options = options || {};
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | true |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.segment.tests.js | test/specs/helpers.segment.tests.js | const {_boundSegment} = Chart.helpers;
describe('helpers.segments', function() {
describe('_boundSegment', function() {
const points = [{x: 10, y: 1}, {x: 20, y: 2}, {x: 30, y: 3}];
const segment = {start: 0, end: 2, loop: false};
it('should not find segment from before the line', function() {
exp... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/element.bar.tests.js | test/specs/element.bar.tests.js | // Test the bar element
describe('Bar element tests', function() {
it('Should correctly identify as in range', function() {
var bar = new Chart.elements.BarElement({
base: 0,
width: 4,
x: 10,
y: 15
});
expect(bar.inRange(10, 15)).toBe(true);
expect(bar.inRange(10, 10)).toBe(t... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.filler.tests.js | test/specs/plugin.filler.tests.js | describe('Plugin.filler', function() {
const fillerPluginRegisterWarning = 'Tried to use the \'fill\' option without the \'Filler\' plugin enabled. Please import and register the \'Filler\' plugin and make sure it is not disabled in the options';
function decodedFillValues(chart) {
return chart.data.datasets.ma... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.animation.tests.js | test/specs/core.animation.tests.js | describe('Chart.Animation', function() {
it('should animate boolean', function() {
const target = {prop: false};
const anim = new Chart.Animation({duration: 1000}, target, 'prop', true);
expect(anim.active()).toBeTrue();
anim.tick(anim._start + 500);
expect(anim.active()).toBeTrue();
expect(t... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.scatter.tests.js | test/specs/controller.scatter.tests.js | describe('Chart.controllers.scatter', function() {
describe('auto', jasmine.fixture.specs('controller.scatter'));
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.scatter).toBe('function');
});
it('should only show a single point in the tooltip on multiple data... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.math.tests.js | test/specs/helpers.math.tests.js | const math = Chart.helpers;
describe('Chart.helpers.math', function() {
var factorize = math._factorize;
var decimalPlaces = math._decimalPlaces;
it('should factorize', function() {
expect(factorize(1000)).toEqual([1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 125, 200, 250, 500]);
expect(factorize(60)).toEqu... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.dom.tests.js | test/specs/helpers.dom.tests.js | describe('DOM helpers tests', function() {
let helpers;
beforeAll(function() {
helpers = window.Chart.helpers;
});
it ('should get the maximum size for a node', function() {
// Create div with fixed size as a test bed
var div = document.createElement('div');
div.style.width = '200px';
div.... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.interaction.tests.js | test/specs/core.interaction.tests.js | describe('Core.Interaction', function() {
describe('auto', jasmine.fixture.specs('core.interaction'));
describe('point mode', function() {
beforeEach(function() {
this.chart = window.acquireChart({
type: 'line',
data: {
datasets: [{
label: 'Dataset 1',
da... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.options.tests.js | test/specs/helpers.options.tests.js | const {toLineHeight, toPadding, toFont, resolve, toTRBLCorners} = Chart.helpers;
describe('Chart.helpers.options', function() {
describe('toLineHeight', function() {
it ('should support keyword values', function() {
expect(toLineHeight('normal', 16)).toBe(16 * 1.2);
});
it ('should support unitless... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.tooltip.tests.js | test/specs/plugin.tooltip.tests.js | // Test the rectangle element
const tooltipPlugin = Chart.registry.getPlugin('tooltip');
const Tooltip = tooltipPlugin._element;
describe('Plugin.Tooltip', function() {
describe('auto', jasmine.fixture.specs('plugin.tooltip'));
describe('config', function() {
it('should not include the dataset label in the bo... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | true |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/scale.category.tests.js | test/specs/scale.category.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
describe('Category scale tests', function() {
describe('auto', jasmine.fixture.specs('scale.category'));
it('Should register the constructor with the registry', function() {
var Constructor = Chart.registry.getScale('category');
expect(... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/element.line.tests.js | test/specs/element.line.tests.js | // Tests for the line element
describe('Chart.elements.LineElement', function() {
describe('auto', jasmine.fixture.specs('element.line'));
it('should be constructed', function() {
var line = new Chart.elements.LineElement({
points: [1, 2, 3, 4]
});
expect(line).not.toBe(undefined);
expect(li... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/global.namespace.tests.js | test/specs/global.namespace.tests.js | describe('Chart namespace', function() {
describe('Chart', function() {
it('should a function (constructor)', function() {
expect(Chart instanceof Function).toBeTruthy();
});
it('should define "core" properties', function() {
expect(Chart instanceof Function).toBeTruthy();
expect(Chart.A... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/platform.dom.tests.js | test/specs/platform.dom.tests.js | const DomPlatform = Chart.platforms.DomPlatform;
describe('Platform.dom', function() {
describe('context acquisition', function() {
var canvasId = 'chartjs-canvas';
beforeEach(function() {
var canvas = document.createElement('canvas');
canvas.setAttribute('id', canvasId);
window.document.... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.collection.tests.js | test/specs/helpers.collection.tests.js | const {_filterBetween, _lookup, _lookupByKey, _rlookupByKey} = Chart.helpers;
describe('helpers.collection', function() {
it('Should do binary search', function() {
const data = [0, 2, 6, 9];
expect(_lookup(data, 0)).toEqual({lo: 0, hi: 1});
expect(_lookup(data, 1)).toEqual({lo: 0, hi: 1});
expect(_l... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.core.tests.js | test/specs/helpers.core.tests.js | 'use strict';
describe('Chart.helpers.core', function() {
var helpers = Chart.helpers;
describe('noop', function() {
it('should be callable', function() {
expect(helpers.noop).toBeDefined();
expect(typeof helpers.noop).toBe('function');
expect(typeof helpers.noop.call).toBe('function');
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.defaults.tests.js | test/specs/core.defaults.tests.js | describe('Chart.defaults', function() {
describe('.set', function() {
it('Should set defaults directly to root when scope is not provided', function() {
expect(Chart.defaults.test).toBeUndefined();
Chart.defaults.set({test: true});
expect(Chart.defaults.test).toEqual(true);
delete Chart.de... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.element.tests.js | test/specs/core.element.tests.js | describe('Chart.element', function() {
describe('getProps', function() {
it('should return requested properties', function() {
const elem = new Chart.Element();
elem.x = 10;
elem.y = 1.5;
expect(elem.getProps(['x', 'y'])).toEqual(jasmine.objectContaining({x: 10, y: 1.5}));
expect(el... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.title.tests.js | test/specs/plugin.title.tests.js | // Test the rectangle element
var Title = Chart.registry.getPlugin('title')._element;
describe('Plugin.title', function() {
describe('auto', jasmine.fixture.specs('plugin.title'));
it('Should have the correct default config', function() {
expect(Chart.defaults.plugins.title).toEqual({
align: 'center',
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.curve.tests.js | test/specs/helpers.curve.tests.js | describe('Curve helper tests', function() {
let helpers;
beforeAll(function() {
helpers = window.Chart.helpers;
});
it('should spline curves', function() {
expect(helpers.splineCurve({
x: 0,
y: 0
}, {
x: 1,
y: 1
}, {
x: 2,
y: 0
}, 0)).toEqual({
pre... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/platform.basic.tests.js | test/specs/platform.basic.tests.js | describe('Platform.basic', function() {
it('should automatically choose the BasicPlatform for offscreen canvas', function() {
const chart = acquireChart({type: 'line'}, {useOffscreenCanvas: true});
expect(chart.platform).toBeInstanceOf(Chart.platforms.BasicPlatform);
chart.destroy();
});
it('shoul... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/plugin.legend.tests.js | test/specs/plugin.legend.tests.js | // Test the rectangle element
describe('Legend block tests', function() {
describe('auto', jasmine.fixture.specs('plugin.legend'));
it('should have the correct default config', function() {
expect(Chart.defaults.plugins.legend).toEqual({
display: true,
position: 'top',
align: 'center',
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/controller.polarArea.tests.js | test/specs/controller.polarArea.tests.js | describe('Chart.controllers.polarArea', function() {
describe('auto', jasmine.fixture.specs('controller.polarArea'));
it('should update the scale correctly when data visibility is changed', function() {
var expectedScaleMax = 1;
var chart = window.acquireChart({
type: 'polarArea',
data: {
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.ticks.tests.js | test/specs/core.ticks.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
describe('Test tick generators', function() {
// formatters are used as default config values so users want to be able to reference them
it('Should expose formatters api', function() {
expect(typeof Chart.Ticks).toBeDefined();
expect(typ... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/helpers.canvas.tests.js | test/specs/helpers.canvas.tests.js | 'use strict';
describe('Chart.helpers.canvas', function() {
describe('auto', jasmine.fixture.specs('helpers'));
var helpers = Chart.helpers;
describe('clearCanvas', function() {
it('should clear the chart canvas', function() {
var chart = acquireChart({}, {
canvas: {
style: 'width: ... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/test/specs/core.layouts.tests.js | test/specs/core.layouts.tests.js | function getLabels(scale) {
return scale.ticks.map(t => t.label);
}
describe('Chart.layouts', function() {
describe('auto', jasmine.fixture.specs('core.layouts'));
it('should be exposed through Chart.layouts', function() {
expect(Chart.layouts).toBeDefined();
expect(typeof Chart.layouts).toBe('object');... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/derived-bubble.js | docs/scripts/derived-bubble.js | import {Chart, BubbleController} from 'chart.js';
class Custom extends BubbleController {
draw() {
// Call bubble controller method to draw all the points
super.draw(arguments);
// Now we can do some custom drawing for this dataset.
// Here we'll draw a box around the first point in each dataset,
... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/log2.js | docs/scripts/log2.js | import {Scale, LinearScale} from 'chart.js';
export default class Log2Axis extends Scale {
constructor(cfg) {
super(cfg);
this._startValue = undefined;
this._valueRange = 0;
}
parse(raw, index) {
const value = LinearScale.prototype.parse.apply(this, [raw, index]);
return isFinite(value) && v... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/register.js | docs/scripts/register.js | import {Chart, registerables} from '../../dist/chart.js';
import Log2Axis from './log2';
import './derived-bubble';
import analyzer from './analyzer';
Chart.register(...registerables);
Chart.register(Log2Axis);
Chart.register(analyzer);
| javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/components.js | docs/scripts/components.js | // Add Chart components needed in samples here.
// Usable through `components[name]`.
export {Tooltip} from '../../dist/chart.js';
| javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/analyzer.js | docs/scripts/analyzer.js | export default {
id: 'samples-filler-analyser',
beforeInit: function(chart, args, options) {
this.element = document.getElementById(options.target);
},
afterUpdate: function(chart) {
var datasets = chart.data.datasets;
var element = this.element;
var stats = [];
var meta, i, ilen, dataset;... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/helpers.js | docs/scripts/helpers.js | // Add helpers needed in samples here.
// Usable through `helpers[name]`.
export {color, getHoverColor, easingEffects} from '../../dist/helpers.js';
| javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/docs/scripts/utils.js | docs/scripts/utils.js | import colorLib from '@kurkle/color';
import {DateTime} from 'luxon';
import 'chartjs-adapter-luxon';
import {valueOrDefault} from '../../dist/helpers.js';
// Adapted from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
var _seed = Date.now();
export function srand(seed) {
_seed = seed;
}
export fun... | javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
chartjs/Chart.js | https://github.com/chartjs/Chart.js/blob/a153556861074e827358446ec937555ac58c3d11/auto/auto.js | auto/auto.js | import {Chart, registerables} from '../dist/chart.js';
Chart.register(...registerables);
export * from '../dist/chart.js';
export default Chart;
| javascript | MIT | a153556861074e827358446ec937555ac58c3d11 | 2026-01-04T14:56:49.667758Z | false |
poteto/hiring-without-whiteboards | https://github.com/poteto/hiring-without-whiteboards/blob/cbf9a3a220a283cff906d785548c69b9dbe95a67/index.js | index.js | module.exports = {}; | javascript | MIT | cbf9a3a220a283cff906d785548c69b9dbe95a67 | 2026-01-04T14:57:26.793391Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/babel.config.js | babel.config.js | module.exports = {
env: {
test: {
presets: [
'@babel/preset-env'
]
},
build: {
presets: [
[
'@babel/preset-env',
{
modules: false,
loose: true
}
]
]
}
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/prettier.config.js | prettier.config.js | module.exports = {
useTabs: false,
printWidth: 80,
singleQuote: true,
trailingComma: 'none',
semi: false
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/karma.sauce.conf.js | karma.sauce.conf.js | module.exports = function (config) {
const batches = [
{
sl_chrome_26: {
base: 'SauceLabs',
browserName: 'chrome',
version: '26'
},
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome'
},
sl_firefox_4: {
base: 'SauceLabs',
brow... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/constant.js | src/constant.js | export const SECONDS_A_MINUTE = 60
export const SECONDS_A_HOUR = SECONDS_A_MINUTE * 60
export const SECONDS_A_DAY = SECONDS_A_HOUR * 24
export const SECONDS_A_WEEK = SECONDS_A_DAY * 7
export const MILLISECONDS_A_SECOND = 1e3
export const MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND
export const MIL... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/index.js | src/index.js | import * as C from './constant'
import en from './locale/en'
import U from './utils'
let L = 'en' // global locale
const Ls = {} // global loaded locale
Ls[L] = en
const IS_DAYJS = '$isDayjsObject'
// eslint-disable-next-line no-use-before-define
const isDayjs = d => d instanceof Dayjs || !!(d && d[IS_DAYJS])
const... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/utils.js | src/utils.js | import * as C from './constant'
const padStart = (string, length, pad) => {
const s = String(string)
if (!s || s.length >= length) return string
return `${Array((length + 1) - s.length).join(pad)}${string}`
}
const padZoneStr = (instance) => {
const negMinutes = -instance.utcOffset()
const minutes = Math.ab... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/bigIntSupport/index.js | src/plugin/bigIntSupport/index.js | // eslint-disable-next-line valid-typeof
const isBigInt = num => typeof num === 'bigint'
export default (o, c, dayjs) => {
const proto = c.prototype
const parseDate = (cfg) => {
const { date } = cfg
if (isBigInt(date)) {
return Number(date)
}
return date
}
const oldParse = proto.parse
p... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/updateLocale/index.js | src/plugin/updateLocale/index.js | export default (option, Dayjs, dayjs) => {
dayjs.updateLocale = function (locale, customConfig) {
const localeList = dayjs.Ls
const localeConfig = localeList[locale]
if (!localeConfig) return
const customConfigKeys = customConfig ? Object.keys(customConfig) : []
customConfigKeys.forEach((c) => {
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/localizedFormat/index.js | src/plugin/localizedFormat/index.js | import { FORMAT_DEFAULT } from '../../constant'
import { u, englishFormats } from './utils'
export default (o, c, d) => {
const proto = c.prototype
const oldFormat = proto.format
d.en.formats = englishFormats
proto.format = function (formatStr = FORMAT_DEFAULT) {
const { formats = {} } = this.$locale()
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/localizedFormat/utils.js | src/plugin/localizedFormat/utils.js | // eslint-disable-next-line import/prefer-default-export
export const t = format =>
format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1))
export const englishFormats = {
LTS: 'h:mm:ss A',
LT: 'h:mm A',
L: 'MM/DD/YYYY',
LL: 'MMMM D, YYYY',
LLL: 'MMMM D, YYYY h:mm A',
LLLL: 'dddd, ... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isBetween/index.js | src/plugin/isBetween/index.js | export default (o, c, d) => {
c.prototype.isBetween = function (a, b, u, i) {
const dA = d(a)
const dB = d(b)
i = i || '()'
const dAi = i[0] === '('
const dBi = i[1] === ')'
return ((dAi ? this.isAfter(dA, u) : !this.isBefore(dA, u)) &&
(dBi ? this.isBefore(dB, u) : !this.isAfter(d... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/toArray/index.js | src/plugin/toArray/index.js | export default (o, c) => {
const proto = c.prototype
proto.toArray = function () {
return [
this.$y,
this.$M,
this.$D,
this.$H,
this.$m,
this.$s,
this.$ms
]
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/arraySupport/index.js | src/plugin/arraySupport/index.js | export default (o, c, dayjs) => {
const proto = c.prototype
const parseDate = (cfg) => {
const { date, utc } = cfg
if (Array.isArray(date)) {
if (utc) {
if (!date.length) {
return new Date()
}
return new Date(Date.UTC.apply(null, date))
}
if (date.length =... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/localeData/index.js | src/plugin/localeData/index.js | import { t } from '../localizedFormat/utils'
export default (o, c, dayjs) => { // locale needed later
const proto = c.prototype
const getLocalePart = part => (part && (part.indexOf ? part : part.s))
const getShort = (ins, target, full, num, localeOrder) => {
const locale = ins.name ? ins : ins.$locale()
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/devHelper/index.js | src/plugin/devHelper/index.js | /* eslint-disable no-console */
export default (o, c, d) => {
/* istanbul ignore next line */
if (!process || process.env.NODE_ENV !== 'production') {
const proto = c.prototype
const oldParse = proto.parse
proto.parse = function (cfg) {
const { date } = cfg
if (typeof date === 'string' && da... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/weekOfYear/index.js | src/plugin/weekOfYear/index.js | import { MS, Y, D, W } from '../../constant'
export default (o, c, d) => {
const proto = c.prototype
proto.week = function (week = null) {
if (week !== null) {
return this.add((week - this.week()) * 7, D)
}
const yearStart = this.$locale().yearStart || 1
if (this.month() === 11 && this.date()... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/dayOfYear/index.js | src/plugin/dayOfYear/index.js | export default (o, c, d) => {
const proto = c.prototype
proto.dayOfYear = function (input) {
// d(this) is for badMutable
const dayOfYear = Math.round((d(this).startOf('day') - d(this).startOf('year')) / 864e5) + 1
return input == null ? dayOfYear : this.add(input - dayOfYear, 'day')
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isoWeek/index.js | src/plugin/isoWeek/index.js | import { D, W, Y } from '../../constant'
const isoWeekPrettyUnit = 'isoweek'
export default (o, c, d) => {
const getYearFirstThursday = (year, isUtc) => {
const yearFirstDay = (isUtc ? d.utc : d)().year(year).startOf(Y)
let addDiffDays = 4 - yearFirstDay.isoWeekday()
if (yearFirstDay.isoWeekday() > 4) {... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/preParsePostFormat/index.js | src/plugin/preParsePostFormat/index.js | // Plugin template from https://day.js.org/docs/en/plugin/plugin
export default (option, dayjsClass) => {
const oldParse = dayjsClass.prototype.parse
dayjsClass.prototype.parse = function (cfg) {
if (typeof cfg.date === 'string') {
const locale = this.$locale()
cfg.date =
locale && locale.pr... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isSameOrAfter/index.js | src/plugin/isSameOrAfter/index.js | export default (o, c) => {
c.prototype.isSameOrAfter = function (that, units) {
return this.isSame(that, units) || this.isAfter(that, units)
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/objectSupport/index.js | src/plugin/objectSupport/index.js | export default (o, c, dayjs) => {
const proto = c.prototype
const isObject = obj => obj !== null && !(obj instanceof Date) && !(obj instanceof Array)
&& !proto.$utils().u(obj) && (obj.constructor.name === 'Object')
const prettyUnit = (u) => {
const unit = proto.$utils().p(u)
return unit === 'date'... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isYesterday/index.js | src/plugin/isYesterday/index.js | export default (o, c, d) => {
const proto = c.prototype
proto.isYesterday = function () {
const comparisonTemplate = 'YYYY-MM-DD'
const yesterday = d().subtract(1, 'day')
return (
this.format(comparisonTemplate) === yesterday.format(comparisonTemplate)
)
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isoWeeksInYear/index.js | src/plugin/isoWeeksInYear/index.js | export default (o, c) => {
const proto = c.prototype
proto.isoWeeksInYear = function () {
const isLeapYear = this.isLeapYear()
const last = this.endOf('y')
const day = last.day()
if (day === 4 || (isLeapYear && day === 5)) {
return 53
}
return 52
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/badMutable/index.js | src/plugin/badMutable/index.js | export default (o, c) => { // locale needed later
const proto = c.prototype
proto.$g = function (input, get, set) {
if (this.$utils().u(input)) return this[get]
return this.$set(set, input)
}
proto.set = function (string, int) {
return this.$set(string, int)
}
const oldStartOf = proto.startOf
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/minMax/index.js | src/plugin/minMax/index.js | export default (o, c, d) => {
const sortBy = (method, dates) => {
if (
!dates ||
!dates.length ||
(dates.length === 1 && !dates[0]) ||
(dates.length === 1 && Array.isArray(dates[0]) && !dates[0].length)
) {
return null
}
if (dates.length === 1 && dates[0].length > 0) {
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/customParseFormat/index.js | src/plugin/customParseFormat/index.js | import { u } from '../localizedFormat/utils'
const formattingTokens = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g
const match1 = /\d/ // 0 - 9
const match2 = /\d\d/ // 00 - 99
const match3 = /\d{3}/ // 000 - 999
const match4 = /\d{4}/ // 0000 - 9999
const match1to2 ... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/negativeYear/index.js | src/plugin/negativeYear/index.js | export default (_, c, dayjs) => {
const proto = c.prototype
const parseDate = (cfg) => {
const { date, utc } = cfg
if (typeof date === 'string' && date.charAt(0) === '-') {
const normalData = date.slice(1)
let newDate = dayjs(normalData)
if (utc) {
newDate = dayjs.utc(normalData)
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/duration/index.js | src/plugin/duration/index.js | import {
MILLISECONDS_A_DAY,
MILLISECONDS_A_HOUR,
MILLISECONDS_A_MINUTE,
MILLISECONDS_A_SECOND,
MILLISECONDS_A_WEEK,
REGEX_FORMAT
} from '../../constant'
const MILLISECONDS_A_YEAR = MILLISECONDS_A_DAY * 365
const MILLISECONDS_A_MONTH = MILLISECONDS_A_YEAR / 12
const durationRegex = /^(-|\+)?P(?:([-+]?[0-9... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isToday/index.js | src/plugin/isToday/index.js | export default (o, c, d) => {
const proto = c.prototype
proto.isToday = function () {
const comparisonTemplate = 'YYYY-MM-DD'
const now = d()
return this.format(comparisonTemplate) === now.format(comparisonTemplate)
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/toObject/index.js | src/plugin/toObject/index.js | export default (o, c) => {
const proto = c.prototype
proto.toObject = function () {
return {
years: this.$y,
months: this.$M,
date: this.$D,
hours: this.$H,
minutes: this.$m,
seconds: this.$s,
milliseconds: this.$ms
}
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/quarterOfYear/index.js | src/plugin/quarterOfYear/index.js | import { Q, M, D } from '../../constant'
export default (o, c) => {
const proto = c.prototype
proto.quarter = function (quarter) {
if (!this.$utils().u(quarter)) {
return this.month((this.month() % 3) + ((quarter - 1) * 3))
}
return Math.ceil((this.month() + 1) / 3)
}
const oldAdd = proto.ad... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/weekYear/index.js | src/plugin/weekYear/index.js | export default (o, c) => {
const proto = c.prototype
proto.weekYear = function () {
const month = this.month()
const weekOfYear = this.week()
const year = this.year()
if (weekOfYear === 1 && month === 11) {
return year + 1
}
if (month === 0 && weekOfYear >= 52) {
return year - 1
... | javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isSameOrBefore/index.js | src/plugin/isSameOrBefore/index.js | export default (o, c) => {
c.prototype.isSameOrBefore = function (that, units) {
return this.isSame(that, units) || this.isBefore(that, units)
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
iamkun/dayjs | https://github.com/iamkun/dayjs/blob/54f447048cee679e51a7053f8042d9b6b7028b89/src/plugin/isMoment/index.js | src/plugin/isMoment/index.js | export default (o, c, f) => {
f.isMoment = function (input) {
return f.isDayjs(input)
}
}
| javascript | MIT | 54f447048cee679e51a7053f8042d9b6b7028b89 | 2026-01-04T14:57:31.496629Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.