New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bodar/totallylazy

Package Overview
Dependencies
Maintainers
2
Versions
310
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bodar/totallylazy - npm Package Compare versions

Comparing version 0.451.293 to 0.452.294

10

dates/core.d.ts

@@ -40,2 +40,5 @@ import { DateFactory } from "./parsing";

export declare const defaultOptions: Options;
/**
* Human readable and ISO 8601 compatible
*/
export declare enum Weekday {

@@ -50,2 +53,6 @@ Monday = 1,

}
export declare function weekdayOf(date: Date): Weekday;
/**
* Human readable and ISO 8601 compatible
*/
export declare enum Month {

@@ -65,2 +72,5 @@ January = 1,

}
export declare function monthOf(date: Date): Month;
export declare function dayOf(date: Date): number;
export declare function yearOf(date: Date): number;
//# sourceMappingURL=core.d.ts.map

33

dates/core.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Month = exports.Weekday = exports.defaultOptions = exports.date = void 0;
exports.yearOf = exports.dayOf = exports.monthOf = exports.Month = exports.weekdayOf = exports.Weekday = exports.defaultOptions = exports.date = void 0;
function date(year, month, day) {

@@ -10,7 +10,7 @@ if (month && (month < 1 || month > 12))

const date = new Date(Date.UTC(year, month ? month - 1 : 0, day ? day : 1));
if (year !== date.getUTCFullYear())
if (year !== yearOf(date))
throw new Error(`Invalid year ${year}`);
if (month && month !== (date.getUTCMonth() + 1))
if (month && month !== monthOf(date))
throw new Error(`Invalid month ${month}`);
if (day && day !== date.getUTCDate())
if (day && day !== dayOf(date))
throw new Error(`Invalid day ${day}`);

@@ -26,2 +26,5 @@ return date;

};
/**
* Human readable and ISO 8601 compatible
*/
var Weekday;

@@ -37,2 +40,12 @@ (function (Weekday) {

})(Weekday = exports.Weekday || (exports.Weekday = {}));
function weekdayOf(date) {
const result = date.getUTCDay();
if (result === 0)
return Weekday.Sunday;
return result;
}
exports.weekdayOf = weekdayOf;
/**
* Human readable and ISO 8601 compatible
*/
var Month;

@@ -53,2 +66,14 @@ (function (Month) {

})(Month = exports.Month || (exports.Month = {}));
function monthOf(date) {
return date.getUTCMonth() + 1;
}
exports.monthOf = monthOf;
function dayOf(date) {
return date.getUTCDate();
}
exports.dayOf = dayOf;
function yearOf(date) {
return date.getUTCFullYear();
}
exports.yearOf = yearOf;
//# sourceMappingURL=core.js.map

19

dates/parsing.d.ts
import { NamedMatch, NamedRegExp } from "../characters";
import { Format, Options } from "./index";
import { Format, Month, Options, Weekday } from "./index";
import { Parser } from "../parsing";

@@ -31,4 +31,5 @@ import { Clock } from "./clock";

day: number;
month: number;
month: Month;
year?: number;
weekday?: Weekday;
}

@@ -41,2 +42,9 @@ export interface DateFactory {

}
export declare class InferYearViaWeekday implements DateFactory {
private clock;
private constructor();
static create(clock: Clock): DateFactory;
create({ year, month, day, weekday }: DateFactoryParts): Date;
private candidates;
}
export declare enum InferDirection {

@@ -46,5 +54,2 @@ Before = -1,

}
export declare class InferYearViaWeekday implements DateFactory {
create(parts: DateFactoryParts): Date;
}
export declare class InferYear implements DateFactory {

@@ -80,3 +85,7 @@ private direction;

export declare class Days {
static milliseconds: number;
static startOf(value: Date): Date;
static add(date: Date, days: number): Date;
static subtract(date: Date, days: number): Date;
static between(a: Date, b: Date): number;
}

@@ -83,0 +92,0 @@ export declare function formatFrom(type: DateTimeFormatPartTypes, length: number): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.localeParser = exports.simpleParser = exports.parser = exports.defaultParserOptions = exports.formatBuilder = exports.optionsFrom = exports.partsFrom = exports.formatRegex = exports.formatFrom = exports.Days = exports.SmartDate = exports.Pivot = exports.InferYear = exports.InferYearViaWeekday = exports.InferDirection = exports.DefaultDateFactory = exports.dateFrom = exports.DateTimeFormatPartParser = exports.DateParser = exports.escapeCharacters = exports.RegexBuilder = exports.parse = void 0;
exports.localeParser = exports.simpleParser = exports.parser = exports.defaultParserOptions = exports.formatBuilder = exports.optionsFrom = exports.partsFrom = exports.formatRegex = exports.formatFrom = exports.Days = exports.SmartDate = exports.Pivot = exports.InferYear = exports.InferDirection = exports.InferYearViaWeekday = exports.DefaultDateFactory = exports.dateFrom = exports.DateTimeFormatPartParser = exports.DateParser = exports.escapeCharacters = exports.RegexBuilder = exports.parse = void 0;
const tslib_1 = require("tslib");

@@ -15,2 +15,3 @@ const lazy_1 = require("../lazy");

const clock_1 = require("./clock");
const sequence_1 = require("../sequence");
function parse(value, locale, options, native = index_1.hasNativeToParts) {

@@ -142,2 +143,25 @@ return parser(locale, options, native).parse(value);

exports.DefaultDateFactory = DefaultDateFactory;
class InferYearViaWeekday {
constructor(clock) {
this.clock = clock;
}
static create(clock) {
return new InferYearViaWeekday(clock);
}
create({ year, month, day, weekday }) {
if (year)
return index_1.date(year, month, day);
if (!weekday)
throw new Error('No weekday provided');
const candidate = this.candidates(month, day).find(c => index_1.weekdayOf(c) === weekday);
if (candidate)
return candidate;
throw new Error('No candidate date found that matches');
}
candidates(month, day) {
const now = Days.startOf(this.clock.now());
return collections_1.array(sequence_1.range(0, 5), transducers_1.zip(sequence_1.range(-1, -5)), transducers_1.flatMap(a => a), parsing_1.mapIgnoreError(inc => index_1.date(index_1.yearOf(now) + inc, month, day)));
}
}
exports.InferYearViaWeekday = InferYearViaWeekday;
var InferDirection;

@@ -148,8 +172,2 @@ (function (InferDirection) {

})(InferDirection = exports.InferDirection || (exports.InferDirection = {}));
class InferYearViaWeekday {
create(parts) {
throw new Error('Not implemented');
}
}
exports.InferYearViaWeekday = InferYearViaWeekday;
class InferYear {

@@ -230,6 +248,18 @@ constructor(date, direction) {

static startOf(value) {
return index_1.date(value.getUTCFullYear(), value.getUTCMonth() + 1, value.getUTCDate());
return index_1.date(index_1.yearOf(value), index_1.monthOf(value), index_1.dayOf(value));
}
static add(date, days) {
const newDate = new Date(date.getTime());
newDate.setUTCDate(date.getUTCDate() + days);
return newDate;
}
static subtract(date, days) {
return Days.add(date, days * -1);
}
static between(a, b) {
return Math.abs((a.getTime() - b.getTime()) / Days.milliseconds);
}
}
exports.Days = Days;
Days.milliseconds = 24 * 60 * 60 * 1000;
function formatFrom(type, length) {

@@ -236,0 +266,0 @@ if (type === 'year') {

{
"name": "@bodar/totallylazy",
"version": "0.451.293",
"version": "0.452.294",
"description": "Totallylazy",

@@ -5,0 +5,0 @@ "repository": "git@github.com:bodar/totallylazy.js.git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc