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

dfts-helper

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dfts-helper - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

15

CHANGELOG.md

@@ -0,1 +1,16 @@

## [1.1.2](https://github.com/Dafnik/dfts-common/compare/dfts-helper-1.1.1...dfts-helper-1.1.2) (2024-10-10)
### Bug Fixes
* **dfts-helper:** read time use trim instead of strip whitespace ([1b2eb30](https://github.com/Dafnik/dfts-common/commit/1b2eb3058d418304f4684fd9b308d1bad4ebaa1e))
* **dfts-helper:** strip whitespace ([3c944fa](https://github.com/Dafnik/dfts-common/commit/3c944fa2dd40f544568e6709bf0a8e13bda7e783))
* lint ([da39bb7](https://github.com/Dafnik/dfts-common/commit/da39bb712d19f2070436a15e21865e28619aa88e))
* make dfts-helper browser info utility SSR compatible ([b6462c9](https://github.com/Dafnik/dfts-common/commit/b6462c9b0cedb9b48ce7c947bd49adc85e99cc45))
### Features
* add more options to imploder ([bc1fc83](https://github.com/Dafnik/dfts-common/commit/bc1fc839d515306962bba03f395c85d2819ce19f))
* imploder updates ([e85e245](https://github.com/Dafnik/dfts-common/commit/e85e245787fee88a2bdb5941ead95fea0d8ad2c8))
## [1.1.1](https://github.com/Dafnik/dfts-common/compare/dfts-helper-1.1.0...dfts-helper-1.1.1) (2023-07-07)

@@ -2,0 +17,0 @@

9

package.json
{
"name": "dfts-helper",
"version": "1.1.1",
"version": "1.1.2",
"description": "Typescript Library with tons of utility tools helping in all projects",

@@ -31,7 +31,8 @@ "private": false,

},
"peerDependencies": {
"tslib": "1.14.1"
"dependencies": {
"tslib": "1 - 2"
},
"module": "./src/index.js",
"main": "./src/index.js",
"types": "./src/index.d.ts"
}
}
# dfts-helper
This library was generated with [Nx](https://nx.dev).
TypeScript Library with tons of utility tools helping in all projects.
## Building
Run `nx build dfts-helper` to build the library.
## Running unit tests
Run `nx test dfts-helper` to execute the unit tests via [Jest](https://jestjs.io).
[![npm version](https://img.shields.io/npm/v/dfts-helper?label=version&color=%237469B6&cacheSeconds=86400)](https://npmjs.org/package/dfts-helper)
[![npm downloads per week](https://img.shields.io/npm/dw/dfts-helper?logo=npm&color=%237469B6)](https://npmjs.org/package/dfts-helper)
[![npm bundle size](https://img.shields.io/bundlephobia/min/dfts-helper?color=%237469B6&cacheSeconds=86400)](https://npmjs.org/package/dfts-helper)

@@ -61,3 +61,2 @@ export * from './lib/decorators/confirmable/confirmable';

export { cl_copy, cl_read } from './lib/helper/clipboard';
export { c_nullToUndefined, c_undefinedToNull, c_unchecked } from './lib/helper/converter/converter';
export { Stopwatch } from './lib/helper/stopwatch/stopwatch';

@@ -68,4 +67,3 @@ export { notNull, notNullAndUndefined } from './lib/helper/filter';

export { loggerOf, Logger, LogHelper } from './lib/logger/logger';
export { IGenericImplTrait } from './lib/traits/generic-impl-trait';
export * from './lib/types';
//# sourceMappingURL=index.d.ts.map

@@ -64,3 +64,2 @@ /*

export { cl_copy, cl_read } from './lib/helper/clipboard';
export { c_nullToUndefined, c_undefinedToNull, c_unchecked } from './lib/helper/converter/converter';
export { Stopwatch } from './lib/helper/stopwatch/stopwatch';

@@ -67,0 +66,0 @@ export { notNull, notNullAndUndefined } from './lib/helper/filter';

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

import { StringOrNumber } from '../types';
/**

@@ -16,3 +15,3 @@ * @since 3.2.5

export type IHasStringID = IHasID<string>;
export type IHasStringOrNumberID = IHasID<StringOrNumber>;
export type IHasStringOrNumberID = IHasID<string | number>;
//# sourceMappingURL=has-id.interface.d.ts.map

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

import { StringOrNumberOr, UndefinedOrNullOr } from '../../../types';
import { UndefinedOrNullOr } from '../../../types';
/**

@@ -8,3 +8,3 @@ * Converts string or number to boolean

*/
export declare const b_from: (value: UndefinedOrNullOr<StringOrNumberOr<boolean>>) => boolean;
export declare const b_from: (value: UndefinedOrNullOr<string | number | boolean>) => boolean;
//# sourceMappingURL=from.d.ts.map
export type BrowserInfo = ReturnType<typeof i_complete>;
export declare const i_screenSize: string;
export declare function i_screenSize(): string;
export declare const i_cookieEnabled: () => boolean;
export declare const i_mobile: boolean;
export declare function i_mobile(): boolean;
/**

@@ -6,0 +6,0 @@ * @return {screenSize: string, name: string, version: string, majorVersion: number, mobile: boolean, os: string, osVersion: string, cookies: boolean, localStorage: boolean}

import { st_isAvailable } from './storage/common';
export const i_screenSize = `${screen.width ?? ''} x ${screen.height ?? ''}`;
export function i_screenSize() {
if (typeof window === 'undefined') {
return '';
}
return `${window?.screen?.width ?? ''} x ${window?.screen?.height ?? ''}`;
}
export const i_cookieEnabled = () => {

@@ -11,3 +16,8 @@ let cookieEnabled = navigator.cookieEnabled;

};
export const i_mobile = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion);
export function i_mobile() {
if (typeof window === 'undefined') {
return false;
}
return /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion);
}
/**

@@ -22,3 +32,3 @@ * @return {screenSize: string, name: string, version: string, majorVersion: number, mobile: boolean, os: string, osVersion: string, cookies: boolean, localStorage: boolean}

let version = '4.0';
let majorVersion = 4;
let majorVersion;
let nameOffset, verOffset, ix;

@@ -162,7 +172,7 @@ // Opera

return {
screenSize: i_screenSize,
screenSize: i_screenSize(),
name: browser,
version: version,
majorVersion: majorVersion,
mobile: i_mobile,
mobile: i_mobile(),
os: os,

@@ -169,0 +179,0 @@ osVersion: osVersion,

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

import { StringOrNumberOr, UndefinedOrNullOr } from '../../types';
import { UndefinedOrNullOr } from '../../types';
/**

@@ -7,3 +7,3 @@ * Converts the given date to a Date object. If the date is undefined, null, or an empty string, returns the current date.

*/
export declare const d_from: (date: UndefinedOrNullOr<StringOrNumberOr<Date>>) => Date;
export declare const d_from: (date: UndefinedOrNullOr<string | number | Date>) => Date;
//# sourceMappingURL=from.d.ts.map

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

import { StringOrNumberOr, UndefinedOrNullOr } from '../../../types';
import { UndefinedOrNullOr } from '../../../types';
/**

@@ -7,3 +7,3 @@ * Converts nearly everything to number

*/
export declare const n_from: (value: UndefinedOrNullOr<StringOrNumberOr<boolean>>) => number;
export declare const n_from: (value: UndefinedOrNullOr<string | number | boolean>) => number;
//# sourceMappingURL=from.d.ts.map

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

import { StringOrNumber } from '../../../types';
/**

@@ -7,3 +6,3 @@ * Checks if object is <code>numeric</code>

*/
export declare const n_isNumeric: (obj: unknown) => obj is StringOrNumber;
export declare const n_isNumeric: (obj: unknown) => obj is string | number;
//# sourceMappingURL=is-numeric.d.ts.map

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

import { StringOrNumberOr, UndefinedOrNullOr } from '../../../types';
import { UndefinedOrNullOr } from '../../../types';
/**

@@ -7,3 +7,3 @@ * Converts nearly everything to string

*/
export declare const s_from: (value: UndefinedOrNullOr<StringOrNumberOr<boolean>>) => string;
export declare const s_from: (value: UndefinedOrNullOr<string | number | boolean>) => string;
//# sourceMappingURL=from.d.ts.map

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

export declare const s_imploder: (source?: string[] | null) => ImploderBuilder;
export declare function s_imploder(): ImploderBuilder;
export declare class ImploderBuilder {

@@ -7,6 +7,6 @@ private _maxLength?;

private _suffix?;
private _forceSuffix?;
private _source?;
static get(source?: string[] | null): ImploderBuilder;
source(source?: string[] | null): this;
mappedSource<T>(source?: T[] | null, mapFn?: (it: T) => string): this;
source<T extends string>(source: T[] | null | undefined, mapFn?: (it: T) => string): this;
source<T>(source: T[] | null | undefined, mapFn: (it: T) => string): this;
maxLength(maxLength?: number | null): this;

@@ -16,4 +16,5 @@ offset(offset?: number | null): this;

suffix(suffix?: string | null): this;
forceSuffix(forceSuffix?: boolean | null): this;
build(): string;
}
//# sourceMappingURL=imploder.d.ts.map

@@ -1,15 +0,16 @@

export const s_imploder = (source) => {
return ImploderBuilder.get(source);
};
export function s_imploder() {
return new ImploderBuilder();
}
export class ImploderBuilder {
static get(source) {
return new ImploderBuilder().source(source);
}
source(source) {
this._source = source;
return this;
}
mappedSource(source, mapFn) {
if (mapFn && source) {
this._source = source.map(mapFn);
source(source, mapFn) {
if (source) {
if (source.every((it) => typeof it === 'string')) {
this._source = source;
}
else if (mapFn) {
this._source = source.map(mapFn);
}
else {
throw 'mapFn required on none string arrays';
}
}

@@ -34,2 +35,6 @@ return this;

}
forceSuffix(forceSuffix) {
this._forceSuffix = forceSuffix;
return this;
}
build() {

@@ -43,9 +48,9 @@ if (!this._source) {

}
const toReturn = source.join(this._separator ?? '');
if (this._maxLength && toReturn.length > this._maxLength) {
return `${toReturn.slice(0, this._maxLength)}${this._suffix ?? ''}`;
const joinedSource = source.join(this._separator ?? '');
if (this._maxLength && joinedSource.length > this._maxLength) {
return `${joinedSource.slice(0, this._maxLength)}${this._suffix ?? ''}`;
}
return toReturn;
return `${joinedSource}${this._forceSuffix ? (this._suffix ?? '') : ''}`;
}
}
//# sourceMappingURL=imploder.js.map

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

import { s_stripWhitespace } from '../strip-whitespace';
import { n_humanizeTime } from '../../number/humanize-time';

@@ -12,3 +11,3 @@ import { s_countWords } from '../count-words/count-words';

*/
export const s_readTime = (text, imageCounter = 0) => n_humanizeTime(imageReadTime(imageCounter) + calculateWordsReadTime(s_stripWhitespace(text)));
export const s_readTime = (text, imageCounter = 0) => n_humanizeTime(imageReadTime(imageCounter) + calculateWordsReadTime(text.trim()));
/**

@@ -15,0 +14,0 @@ * Calculates the estimated time it takes to read text based on the number of words and a given words per minute rate.

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

export const s_stripWhitespace = (text) => text?.trim().replace(/^\s+/, '').replace(/\s+$/, '') ?? '';
export const s_stripWhitespace = (text) => text?.trim().replace(/\s/g, '') ?? '';
//# sourceMappingURL=strip-whitespace.js.map

@@ -13,3 +13,3 @@ const isUrlRegEx = new RegExp('^(https?:\\/\\/)?' + // protocol

export const s_isUrl = (url) => isUrlRegEx.test(url ?? '');
export const s_isNoUrl = (url) => !isUrlRegEx.test(url ?? '');
export const s_isNoUrl = (url) => !s_isUrl(url);
//# sourceMappingURL=url.js.map
import { IHasID } from './entities/has-id.interface';
import { IHasName } from './entities/has-name.interface';
export type UnknownOr<T> = T | unknown;
export type UndefinedOr<T> = T | undefined;
export type NullOr<T> = T | null;
export type UndefinedOrNullOr<T> = UndefinedOr<NullOr<T>>;
export type NullOrUndefinedOr<T> = UndefinedOrNullOr<T>;
export type ManyOr<T> = T | T[];
export type ManyOrUndefinedOr<T> = UndefinedOr<ManyOr<T>>;
export type ManyOrNullOr<T> = NullOr<ManyOr<T>>;
export type ManyOrUndefinedOrNullOr<T> = UndefinedOrNullOr<ManyOr<T>>;
export type StringOr<T> = string | T;
export type StringOrNumber = StringOr<number>;
export type StringOrNumberOr<T> = StringOrNumber | T;
export type typeOfArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;

@@ -19,3 +10,2 @@ export type HasIDAndName<T> = IHasID<T> & IHasName;

export type HasStringIDAndName = HasIDAndName<string>;
export type HasStringOrNumberIDAndName = HasIDAndName<StringOrNumber>;
export interface IBuilder<T> {

@@ -36,3 +26,3 @@ build(): T;

}
export type DateInput = UndefinedOrNullOr<StringOrNumberOr<Date>>;
export type DateInput = UndefinedOrNullOr<string | number | Date>;
//# sourceMappingURL=types.d.ts.map

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 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 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 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 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 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 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 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 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