Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

onix-core

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onix-core - npm Package Compare versions

Comparing version 1.1.27 to 1.2.28

built/fn/date/DateToUTCString.d.ts

2

built/fn/array/index.d.ts

@@ -1,4 +0,2 @@

export { inArray } from './InArray';
export { indexOf } from './IndexOf';
export { grep } from './Grep';
export { pushif } from './Pushif';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var InArray_1 = require("./InArray");
exports.inArray = InArray_1.inArray;
var IndexOf_1 = require("./IndexOf");
exports.indexOf = IndexOf_1.indexOf;
var Grep_1 = require("./Grep");

@@ -8,0 +4,0 @@ exports.grep = Grep_1.grep;

@@ -90,2 +90,2 @@ "use strict";

};
//# sourceMappingURL=formatTimestamp.js.map
//# sourceMappingURL=FormatTimestamp.js.map

@@ -1,3 +0,3 @@

export declare const dateToUTCString: (date: any) => string;
export declare const parseDate: (value: any) => any;
export { formatTimestamp } from './formatTimestamp';
export { formatTimestamp } from './FormatTimestamp';
export { parseMicrosoftFormatOffset } from './ParseMicrosoftFormatOffset';
export { dateToUTCString } from './DateToUTCString';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Types_1 = require("../Types");
var IntVal_1 = require("../number/IntVal");
var Timezone_1 = require("./Timezone");
var valueToTwoDigits = function (value) {
return ((value < 10) ? '0' : '') + value;
};
// ===================== Date ========================
var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var dateRegExp = /^\/Date\((.*?)\)\/$/;
var offsetRegExp = /[+-]\d*/;
exports.dateToUTCString = function (date) {
var time = valueToTwoDigits(date.getUTCHours()) + ':' + valueToTwoDigits(date.getUTCMinutes()) + ':' + valueToTwoDigits(date.getUTCSeconds());
return days[date.getUTCDay()] + ', ' + valueToTwoDigits(date.getUTCDate()) + ' ' + months[date.getUTCMonth()] + ' ' + date.getUTCFullYear() + ' ' + time + ' GMT';
};
var parseMicrosoftFormatOffset = function (offset) {
var sign = offset.substr(0, 1) === "-" ? -1 : 1;
offset = offset.substring(1);
var result = (IntVal_1.intVal(offset.substr(0, 2)) * 60) + IntVal_1.intVal(offset.substring(2));
return sign * result;
};
exports.parseDate = function (value) {
if (Types_1.isDate(value)) {
return value;
}
if (value && value.indexOf("/D") === 0) {
var rDate = dateRegExp.exec(value);
if (rDate) {
var str = rDate[1];
var rTz = offsetRegExp.exec(str.substring(1));
var date = new Date(IntVal_1.intVal(str));
if (rTz) {
var tzoffset = parseMicrosoftFormatOffset(rTz[0]);
var timezone = new Timezone_1.Timezone();
date = timezone.apply(date, 0);
date = timezone.convert(date, 0, -1 * tzoffset);
}
return date;
}
}
return value;
};
var formatTimestamp_1 = require("./formatTimestamp");
exports.formatTimestamp = formatTimestamp_1.formatTimestamp;
var FormatTimestamp_1 = require("./FormatTimestamp");
exports.formatTimestamp = FormatTimestamp_1.formatTimestamp;
var ParseMicrosoftFormatOffset_1 = require("./ParseMicrosoftFormatOffset");
exports.parseMicrosoftFormatOffset = ParseMicrosoftFormatOffset_1.parseMicrosoftFormatOffset;
var DateToUTCString_1 = require("./DateToUTCString");
exports.dateToUTCString = DateToUTCString_1.dateToUTCString;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Types_1 = require("../Types");
var IndexOf_1 = require("../array/IndexOf");
var indexOf = require("lodash/indexOf");
var isDate = require("lodash/isDate");
var isString = require("lodash/isString");
var Grep_1 = require("../array/Grep");

@@ -66,3 +67,3 @@ var Timezones_1 = require("./Timezones");

});
var rule = rules[IndexOf_1.indexOf(utcTime, rules) - 1] || rules[rules.length - 1];
var rule = rules[indexOf(rules, utcTime) - 1] || rules[rules.length - 1];
return isNaN(rule) ? rule : null;

@@ -91,3 +92,3 @@ }

function zoneAndRule(utcTime, zones, rules, timezone) {
if (!Types_1.isNumber(utcTime)) {
if (isDate(utcTime)) {
utcTime = Date.UTC(utcTime.getFullYear(), utcTime.getMonth(), utcTime.getDate(), utcTime.getHours(), utcTime.getMinutes(), utcTime.getSeconds(), utcTime.getMilliseconds());

@@ -118,6 +119,6 @@ }

Timezone.prototype.convert = function (date, fromOffset, toOffset) {
if (Types_1.isString(fromOffset)) {
if (isString(fromOffset)) {
fromOffset = this.offset(date, fromOffset);
}
if (Types_1.isString(toOffset)) {
if (isString(toOffset)) {
toOffset = this.offset(date, toOffset);

@@ -124,0 +125,0 @@ }

@@ -1,5 +0,1 @@

export { intVal } from './IntVal';
export { isValueOutOfRange } from './IsValueOutOfRange';
export { ensureValueInRange } from './EnsureValueInRange';
export { average } from './Average';
export { stdDeviation } from './StdDeviation';
"use strict";
// use _.range export { isValueOutOfRange } from './IsValueOutOfRange';
// use _.clamp export { ensureValueInRange } from './EnsureValueInRange';
Object.defineProperty(exports, "__esModule", { value: true });
var IntVal_1 = require("./IntVal");
exports.intVal = IntVal_1.intVal;
var IsValueOutOfRange_1 = require("./IsValueOutOfRange");
exports.isValueOutOfRange = IsValueOutOfRange_1.isValueOutOfRange;
var EnsureValueInRange_1 = require("./EnsureValueInRange");
exports.ensureValueInRange = EnsureValueInRange_1.ensureValueInRange;
var Average_1 = require("./Average");
exports.average = Average_1.average;
var StdDeviation_1 = require("./StdDeviation");
exports.stdDeviation = StdDeviation_1.stdDeviation;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Average_1 = require("./Average");
var mean = require("lodash/mean");
exports.stdDeviation = function (arr) {
var avg = Average_1.average(arr), sum = 0;
var avg = mean(arr), sum = 0;
for (var i = 0; i < arr.length; i++) {

@@ -7,0 +7,0 @@ sum += Math.pow(arr[i] - avg, 2);

@@ -1,7 +0,3 @@

export { strRepeat } from './StrRepeat';
export { trim } from './Trim';
export { pad } from './Pad';
export { justify } from './Justify';
export { capitalize } from './Capitalize';
export { pluralize } from './Pluralize';
export { sprintf } from './Sprintf';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var StrRepeat_1 = require("./StrRepeat");
exports.strRepeat = StrRepeat_1.strRepeat;
var Trim_1 = require("./Trim");
exports.trim = Trim_1.trim;
var Pad_1 = require("./Pad");
exports.pad = Pad_1.pad;
var Justify_1 = require("./Justify");
exports.justify = Justify_1.justify;
var Capitalize_1 = require("./Capitalize");
exports.capitalize = Capitalize_1.capitalize;
var Pluralize_1 = require("./Pluralize");

@@ -14,0 +6,0 @@ exports.pluralize = Pluralize_1.pluralize;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Pad_1 = require("./Pad");
var padStart = require("lodash/padStart");
var padEnd = require("lodash/padEnd");
exports.justify = function (value, prefix, leftJustify, minWidth, zeroPad) {

@@ -8,6 +9,6 @@ var diff = minWidth - value.length;

if (leftJustify || !zeroPad) {
value = Pad_1.pad(value, minWidth, ' ', leftJustify);
value = leftJustify ? padStart(value, minWidth) : padEnd(value, minWidth);
}
else {
value = value.slice(0, prefix.length) + Pad_1.pad('', diff, '0', true) + value.slice(prefix.length);
value = value.slice(0, prefix.length) + padStart('', diff, '0') + value.slice(prefix.length);
}

@@ -14,0 +15,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Pad_1 = require("./Pad");
var toSafeInteger = require("lodash/toSafeInteger");
var padStart = require("lodash/padStart");
var padEnd = require("lodash/padEnd");
var Justify_1 = require("./Justify");
var IntVal_1 = require("../number/IntVal");
// formatBaseX()

@@ -11,3 +12,3 @@ var formatBaseX = function (value, base, prefixBaseX, leftJustify, minWidth, precision, zeroPad) {

var prefix = prefixBaseX && number && { '2': '0b', '8': '0', '10': '', '16': '0x' }[base] || '';
var result = prefix + Pad_1.pad(number.toString(base), precision || 0, '0', false);
var result = prefix + padStart(number.toString(base), precision || 0, '0');
return Justify_1.justify(result, prefix, leftJustify, minWidth, zeroPad);

@@ -99,5 +100,5 @@ };

case 'd': {
var number = IntVal_1.intVal(+value);
var number = toSafeInteger(+value);
var prefix = number < 0 ? '-' : positivePrefix;
value = prefix + Pad_1.pad(String(Math.abs(number)), precision, '0', false);
value = prefix + padEnd(String(Math.abs(number)), precision, '0');
return Justify_1.justify(value, prefix, leftJustify, minWidth, zeroPad);

@@ -104,0 +105,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Types_1 = require("../Types");
var isFunction = require("lodash/isFunction");
exports.createChainedFunction = function () {

@@ -10,5 +10,5 @@ var funcs = [];

return funcs
.filter(function (f) { return (Types_1.isFunction(f)); })
.filter(function (f) { return (isFunction(f)); })
.reduce(function (acc, f) {
if (typeof f !== 'function') {
if (!isFunction(f)) {
throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');

@@ -15,0 +15,0 @@ }

@@ -1,2 +0,1 @@

export * from './fn/Types';
export * from './fn/array/index';

@@ -3,0 +2,0 @@ export * from './fn/string/index';

@@ -6,3 +6,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./fn/Types"));
__export(require("./fn/array/index"));

@@ -9,0 +8,0 @@ __export(require("./fn/string/index"));

{
"name": "onix-core",
"version": "1.1.27",
"version": "1.2.28",
"description": "Onix library core",

@@ -24,5 +24,7 @@ "main": "built/index.js",

"dependencies": {
"lodash": "^4.17.4",
"warning": "^3.0.0"
},
"devDependencies": {
"@types/lodash": "^4.14.73",
"@types/node": "^7.0.39",

@@ -29,0 +31,0 @@ "awesome-typescript-loader": "^3.2.2",

@@ -0,0 +0,0 @@ export interface IUser {

@@ -0,0 +0,0 @@ import { IDisposable, ITyped } from '../Types';

@@ -0,0 +0,0 @@ import { IEventArgs, IEventArgs1 } from './IEventArgs';

@@ -0,0 +0,0 @@ import { IEventArgs, IEventArgs1 } from './IEventArgs';

@@ -0,0 +0,0 @@ import { IEventArgs, IEventArgs1 } from './IEventArgs';

@@ -0,0 +0,0 @@ export interface IEventArgs {

@@ -0,0 +0,0 @@ import { IEventArgs, IEventArgs1 } from './IEventArgs';

@@ -0,0 +0,0 @@ export { IEventArgs, IEventArgs1 } from './IEventArgs';

@@ -0,0 +0,0 @@ export const grep = (elems: any[], callback: Function, invert?: boolean) => {

@@ -1,4 +0,2 @@

export { inArray } from './InArray';
export { indexOf } from './IndexOf';
export { grep } from './Grep';
export { pushif } from './Pushif';

@@ -0,0 +0,0 @@ export const pushif = (a: any[], cond: boolean, val: any) => {

@@ -1,57 +0,3 @@

import { isDate } from '../Types';
import { intVal } from '../number/IntVal';
import { Timezone } from './Timezone';
const valueToTwoDigits = function (value) {
return ((value < 10) ? '0' : '') + value;
};
// ===================== Date ========================
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const dateRegExp = /^\/Date\((.*?)\)\/$/;
const offsetRegExp = /[+-]\d*/;
export const dateToUTCString = (date) => {
const time = valueToTwoDigits(date.getUTCHours()) + ':' + valueToTwoDigits(date.getUTCMinutes()) + ':' + valueToTwoDigits(date.getUTCSeconds());
return days[date.getUTCDay()] + ', ' + valueToTwoDigits(date.getUTCDate()) + ' ' + months[date.getUTCMonth()] + ' ' + date.getUTCFullYear() + ' ' + time + ' GMT';
};
const parseMicrosoftFormatOffset = (offset: string) => {
var sign = offset.substr(0, 1) === "-" ? -1 : 1;
offset = offset.substring(1);
const result = (intVal(offset.substr(0, 2)) * 60) + intVal(offset.substring(2));
return sign * result;
}
export const parseDate = (value) => {
if (isDate(value)) {
return value;
}
if (value && value.indexOf("/D") === 0) {
const rDate = dateRegExp.exec(value);
if (rDate) {
const str = rDate[1];
let rTz = offsetRegExp.exec(str.substring(1));
let date = new Date(intVal(str));
if (rTz) {
let tzoffset = parseMicrosoftFormatOffset(rTz[0]);
const timezone = new Timezone();
date = timezone.apply(date, 0);
date = timezone.convert(date, 0, -1 * tzoffset);
}
return date;
}
}
return value;
}
export { formatTimestamp } from './formatTimestamp';
export { formatTimestamp } from './FormatTimestamp';
export { parseMicrosoftFormatOffset } from './ParseMicrosoftFormatOffset';
export { dateToUTCString } from './DateToUTCString';

@@ -1,6 +0,4 @@

export { intVal } from './IntVal';
export { isValueOutOfRange } from './IsValueOutOfRange';
export { ensureValueInRange } from './EnsureValueInRange';
// use _.range export { isValueOutOfRange } from './IsValueOutOfRange';
// use _.clamp export { ensureValueInRange } from './EnsureValueInRange';
export { average } from './Average';
export { stdDeviation } from './StdDeviation';

@@ -1,5 +0,5 @@

import { average } from './Average';
import mean = require('lodash/mean');
export const stdDeviation = (arr: number[]) => {
var avg = average(arr), sum = 0;
var avg = mean(arr), sum = 0;

@@ -6,0 +6,0 @@ for (var i = 0; i < arr.length; i++) {

@@ -1,8 +0,3 @@

export { strRepeat } from './StrRepeat';
export { trim } from './Trim';
export { pad } from './Pad';
export { justify } from './Justify';
export { capitalize } from './Capitalize';
export { pluralize } from './Pluralize';
export { sprintf } from './Sprintf';

@@ -1,2 +0,3 @@

import { pad } from './Pad';
import padStart = require('lodash/padStart');
import padEnd = require('lodash/padEnd');

@@ -7,8 +8,9 @@ export const justify = (value: string, prefix: string, leftJustify: boolean, minWidth: number, zeroPad: boolean) => {

if (leftJustify || !zeroPad) {
value = pad(value, minWidth, ' ', leftJustify);
value = leftJustify ? padStart(value, minWidth) : padEnd(value, minWidth);
} else {
value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length);
value = value.slice(0, prefix.length) + padStart('', diff, '0') + value.slice(prefix.length);
}
}
return value;
}

@@ -0,0 +0,0 @@ export const pluralize = (num: number, strOne: string, strTwo: string, strFive: string) => {

@@ -1,4 +0,5 @@

import { pad } from './Pad';
import toSafeInteger = require('lodash/toSafeInteger');
import padStart = require('lodash/padStart');
import padEnd = require('lodash/padEnd');
import { justify } from './Justify';
import { intVal } from '../number/IntVal';

@@ -12,3 +13,3 @@ export type RadixType = 2 | 8 | 10 | 16;

const prefix = prefixBaseX && number && {'2': '0b', '8': '0', '10': '', '16': '0x'}[base] || '';
const result = prefix + pad(number.toString(base), precision || 0, '0', false);
const result = prefix + padStart(number.toString(base), precision || 0, '0');
return justify(result, prefix, leftJustify, minWidth, zeroPad);

@@ -89,5 +90,5 @@ }

case 'd': {
var number = intVal(+value);
var number = toSafeInteger(+value);
var prefix = number < 0 ? '-' : positivePrefix;
value = prefix + pad(String(Math.abs(number)), precision, '0', false);
value = prefix + padEnd(String(Math.abs(number)), precision, '0');
return justify(value, prefix, leftJustify, minWidth, zeroPad);

@@ -94,0 +95,0 @@ }

@@ -1,2 +0,2 @@

import { isFunction } from '../Types';
import isFunction = require('lodash/isFunction');

@@ -7,3 +7,3 @@ export const createChainedFunction = (...funcs) => {

.reduce((acc, f) => {
if (typeof f !== 'function') {
if (!isFunction(f)) {
throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');

@@ -10,0 +10,0 @@ }

export interface Hashtable<T> {
[key: string]: T;
}

@@ -1,2 +0,1 @@

export * from './fn/Types';
export * from './fn/array/index';

@@ -3,0 +2,0 @@ export * from './fn/string/index';

@@ -0,0 +0,0 @@ const wnd: Window = window;

@@ -0,0 +0,0 @@ export interface IDisposable {

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

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

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 too big to display

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