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.452.294 to 0.453.295

5

dates/parsing.d.ts

@@ -28,3 +28,3 @@ import { NamedMatch, NamedRegExp } from "../characters";

}
export declare function dateFrom(parts: DateTimeFormatPart[], locale: string, options?: Options): Date;
export declare function dateFrom(parts: DateTimeFormatPart[], locale: string, factory?: DateFactory): Date;
export interface DateFactoryParts {

@@ -42,6 +42,7 @@ day: number;

}
export declare function compositeDateFactory(...factories: DateFactory[]): DateFactory;
export declare class InferYearViaWeekday implements DateFactory {
private clock;
private constructor();
static create(clock: Clock): DateFactory;
static create(clock?: Clock): DateFactory;
create({ year, month, day, weekday }: DateFactoryParts): Date;

@@ -48,0 +49,0 @@ private candidates;

32

dates/parsing.js
"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.InferDirection = exports.InferYearViaWeekday = 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.compositeDateFactory = exports.DefaultDateFactory = exports.dateFrom = exports.DateTimeFormatPartParser = exports.DateParser = exports.escapeCharacters = exports.RegexBuilder = exports.parse = void 0;
const tslib_1 = require("tslib");

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

const cache_1 = require("../cache");
const functions_1 = require("../functions");
const clock_1 = require("./clock");

@@ -93,3 +92,3 @@ const sequence_1 = require("../sequence");

const pattern = RegexBuilder.create(locale, options, native).pattern;
return parsing_1.mappingParser(DateTimeFormatPartParser.create(characters_1.NamedRegExp.create(pattern), locale), p => dateFrom(p, locale, typeof options === "object" ? options : undefined));
return parsing_1.mappingParser(DateTimeFormatPartParser.create(characters_1.NamedRegExp.create(pattern), locale), p => dateFrom(p, locale, typeof options === "object" ? options.factory : undefined));
}

@@ -119,3 +118,3 @@ }

exports.DateTimeFormatPartParser = DateTimeFormatPartParser;
function dateFrom(parts, locale, options) {
function dateFrom(parts, locale, factory = new DefaultDateFactory()) {
const parser = parsing_1.numberParser('.', locale);

@@ -132,4 +131,2 @@ const [dayText] = parts.filter(p => p.type === 'day');

const year = yearText ? parser.parse(yearText.value) : undefined;
// @ts-ignore
const factory = functions_1.get(() => options.factory, new DefaultDateFactory());
return factory.create({ year, month, day });

@@ -146,2 +143,21 @@ }

exports.DefaultDateFactory = DefaultDateFactory;
class CompositeDateFactory {
constructor(factories) {
this.factories = factories;
}
create(parts) {
for (const factory of this.factories) {
try {
return factory.create(parts);
}
catch (e) {
}
}
throw new Error(`Unable to create date for ${JSON.stringify(parts)}`);
}
}
function compositeDateFactory(...factories) {
return new CompositeDateFactory(factories);
}
exports.compositeDateFactory = compositeDateFactory;
class InferYearViaWeekday {

@@ -151,3 +167,3 @@ constructor(clock) {

}
static create(clock) {
static create(clock = new clock_1.SystemClock()) {
return new InferYearViaWeekday(clock);

@@ -189,3 +205,3 @@ }

const now = clock.now();
return InferYear.before(index_1.date(now.getUTCFullYear() + 50, 1, 1));
return InferYear.before(index_1.date(index_1.yearOf(now) + 50, 1, 1));
}

@@ -192,0 +208,0 @@ create({ year, month, day }) {

{
"name": "@bodar/totallylazy",
"version": "0.452.294",
"version": "0.453.295",
"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

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