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

ntils

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ntils - npm Package Compare versions

Comparing version 5.2.3 to 5.2.4

37

dist/cjs.js

@@ -5,2 +5,13 @@ 'use strict';

var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {

@@ -123,19 +134,19 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;

}
function formatDate(value, format, dict) {
function formatDate(value, format, options) {
if (isNull(format) || isNull(value))
return String(value);
var date = toDate(value);
dict = dict || {};
var _a = __assign({}, options), _b = _a.utc, utc = _b === void 0 ? false : _b, _c = _a.translate, translate = _c === void 0 ? {} : _c;
var dt = toDate(value);
var placeholder = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"w+": date.getDay(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
"M+": (utc ? dt.getUTCMonth() : dt.getMonth()) + 1,
"d+": utc ? dt.getUTCDate() : dt.getDate(),
"h+": utc ? dt.getUTCHours() : dt.getHours(),
"m+": utc ? dt.getUTCMinutes() : dt.getMinutes(),
"s+": utc ? dt.getUTCSeconds() : dt.getSeconds(),
"w+": utc ? dt.getUTCDay() : dt.getDay(),
"q+": Math.floor(((utc ? dt.getUTCMonth() : dt.getMonth()) + 3) / 3),
"S": utc ? dt.getUTCMilliseconds() : dt.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
format = format.replace(RegExp.$1, (dt.getFullYear() + "").substr(4 - RegExp.$1.length));
}

@@ -145,3 +156,3 @@ for (var key in placeholder) {

var value_1 = placeholder[key];
value_1 = dict[value_1] || value_1;
value_1 = translate[value_1] || value_1;
format = format.replace(RegExp.$1, RegExp.$1.length === 1

@@ -148,0 +159,0 @@ ? value_1

@@ -0,1 +1,12 @@

var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = (this && this.__spreadArrays) || function () {

@@ -118,19 +129,19 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;

}
export function formatDate(value, format, dict) {
export function formatDate(value, format, options) {
if (isNull(format) || isNull(value))
return String(value);
var date = toDate(value);
dict = dict || {};
var _a = __assign({}, options), _b = _a.utc, utc = _b === void 0 ? false : _b, _c = _a.translate, translate = _c === void 0 ? {} : _c;
var dt = toDate(value);
var placeholder = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"w+": date.getDay(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
"M+": (utc ? dt.getUTCMonth() : dt.getMonth()) + 1,
"d+": utc ? dt.getUTCDate() : dt.getDate(),
"h+": utc ? dt.getUTCHours() : dt.getHours(),
"m+": utc ? dt.getUTCMinutes() : dt.getMinutes(),
"s+": utc ? dt.getUTCSeconds() : dt.getSeconds(),
"w+": utc ? dt.getUTCDay() : dt.getDay(),
"q+": Math.floor(((utc ? dt.getUTCMonth() : dt.getMonth()) + 3) / 3),
"S": utc ? dt.getUTCMilliseconds() : dt.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
format = format.replace(RegExp.$1, (dt.getFullYear() + "").substr(4 - RegExp.$1.length));
}

@@ -140,3 +151,3 @@ for (var key in placeholder) {

var value_1 = placeholder[key];
value_1 = dict[value_1] || value_1;
value_1 = translate[value_1] || value_1;
format = format.replace(RegExp.$1, RegExp.$1.length === 1

@@ -143,0 +154,0 @@ ? value_1

var ntils = (function (exports) {
'use strict';
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {

@@ -121,19 +132,19 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;

}
function formatDate(value, format, dict) {
function formatDate(value, format, options) {
if (isNull(format) || isNull(value))
return String(value);
var date = toDate(value);
dict = dict || {};
var _a = __assign({}, options), _b = _a.utc, utc = _b === void 0 ? false : _b, _c = _a.translate, translate = _c === void 0 ? {} : _c;
var dt = toDate(value);
var placeholder = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"w+": date.getDay(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
"M+": (utc ? dt.getUTCMonth() : dt.getMonth()) + 1,
"d+": utc ? dt.getUTCDate() : dt.getDate(),
"h+": utc ? dt.getUTCHours() : dt.getHours(),
"m+": utc ? dt.getUTCMinutes() : dt.getMinutes(),
"s+": utc ? dt.getUTCSeconds() : dt.getSeconds(),
"w+": utc ? dt.getUTCDay() : dt.getDay(),
"q+": Math.floor(((utc ? dt.getUTCMonth() : dt.getMonth()) + 3) / 3),
"S": utc ? dt.getUTCMilliseconds() : dt.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
format = format.replace(RegExp.$1, (dt.getFullYear() + "").substr(4 - RegExp.$1.length));
}

@@ -143,3 +154,3 @@ for (var key in placeholder) {

var value_1 = placeholder[key];
value_1 = dict[value_1] || value_1;
value_1 = translate[value_1] || value_1;
format = format.replace(RegExp.$1, RegExp.$1.length === 1

@@ -146,0 +157,0 @@ ? value_1

@@ -7,2 +7,13 @@ (function (global, factory) {

var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {

@@ -125,19 +136,19 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;

}
function formatDate(value, format, dict) {
function formatDate(value, format, options) {
if (isNull(format) || isNull(value))
return String(value);
var date = toDate(value);
dict = dict || {};
var _a = __assign({}, options), _b = _a.utc, utc = _b === void 0 ? false : _b, _c = _a.translate, translate = _c === void 0 ? {} : _c;
var dt = toDate(value);
var placeholder = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"w+": date.getDay(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
"M+": (utc ? dt.getUTCMonth() : dt.getMonth()) + 1,
"d+": utc ? dt.getUTCDate() : dt.getDate(),
"h+": utc ? dt.getUTCHours() : dt.getHours(),
"m+": utc ? dt.getUTCMinutes() : dt.getMinutes(),
"s+": utc ? dt.getUTCSeconds() : dt.getSeconds(),
"w+": utc ? dt.getUTCDay() : dt.getDay(),
"q+": Math.floor(((utc ? dt.getUTCMonth() : dt.getMonth()) + 3) / 3),
"S": utc ? dt.getUTCMilliseconds() : dt.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
format = format.replace(RegExp.$1, (dt.getFullYear() + "").substr(4 - RegExp.$1.length));
}

@@ -147,3 +158,3 @@ for (var key in placeholder) {

var value_1 = placeholder[key];
value_1 = dict[value_1] || value_1;
value_1 = translate[value_1] || value_1;
format = format.replace(RegExp.$1, RegExp.$1.length === 1

@@ -150,0 +161,0 @@ ? value_1

{
"name": "ntils",
"version": "5.2.3",
"version": "5.2.4",
"description": "一个 Node & Browser 工具函数集",

@@ -5,0 +5,0 @@ "main": "./dist/cjs.js",

@@ -21,3 +21,6 @@ export declare function noop(): void;

export declare function replace(str: string, from: string, to: string): string;
export declare function formatDate(value: Date | number | string, format: string, dict?: any): string;
export declare function formatDate(value: Date | number | string, format: string, options?: {
utc?: boolean;
translate?: Record<string, string>;
}): string;
export declare function each(list: any, handler: (key: string | number, value: any) => any, scope: any): any;

@@ -24,0 +27,0 @@ export declare function copy(src: any, dst?: any, ignores?: string[]): any;

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