npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

clv-ts-utils

v2.0.0

Published

Angular application utilities. # Summary [ClvTsUtilsCommonsJs](#clvtsutilscommonsjs) - [enumarableFromListEqual](#enumarablefromlistequal) - [getObjectByFieldValue](#getobjectbyfieldvalue) - [objectSumField](#objectsumfield) - [getObjectOffsetIn

Downloads

15

Readme

ClvTsUtils

Angular application utilities.

Summary

ClvTsUtilsCommonsJs

ClvStringsUtils

ClvFilesUtils

ClvTsUtilsCommonsJs

enumarableFromListEqual

static enumarableFromListEqual(list: any[], column: string, value: any): any[]

Returns a sublist of elements based on the value of a field.

getObjectByFieldValue

static getObjectByFieldValue(obj: any[], fieldname: string, fieldvalue: any): any

Returns an object by the value of one of its fields

objectSumField

static objectSumField(objs: any[], fieldName: string): number

Sum the values of a field in a list of objects

getObjectOffsetInArrayByField

static getObjectOffsetInArrayByField(arr: any[], obj: any, fieldName: string): number

Returns the offset of an object in a list by comparing the value of one of its fields

getObjectOffsetInArray

static getObjectOffsetInArray(arr: any[], obj: any): number

Retrieves the offset of the first occurrence of an element in an array or returns -1 if no result matches.

jsType

static jsType(obj: any): string

Determine the exact type of a variable

copy

static copy<O>(obj: O): O

Duplicates a variable

cleanSpace

static cleanSpace(value: string): string

Deletes the spaces of a string

isUndefinedOrNull

static isUndefinedOrNull(value: any): boolean

Check that an object is not defined

stringIsUndefinedOrNull

static stringIsUndefinedOrNull(value: string): boolean

Check that a string is undefined

thousandSeparator

static thousandSeparator(value: string | number, decimalPre: number = 2,  mode: ThousandSeparatorMode = ThousandSeparatorMode.DEFAULT): string

Formats a number by thousands separators. Mode can be DEFAULT, DECIMAL_MANDATORY or DECIMAL_OPTIONAL

roundDecimalNumber

static roundDecimalNumber(value: number, decimalPre: number = 1)

Rounds a number

strXCharsFromBackAt

static strXCharsFromBackAt(value: string, charLength: number, position: number)

retrieves x characters from the end of a string

deleteFromArray

static deleteFromArray (array: any[], item: any)

Deletes an item or list of items from a array

Convert from csv to json format

ClvStringsUtils

insertAboveAnchor

static insertAboveAnchor(str: string, toAdd: string, anchor: string): string

Insert a string inside another over an anchor

insertBelowAnchor

static insertBelowAnchor(str: string, toAdd: string, anchor: string): string

Insert a string inside another below an anchor

ClvFilesUtils

fileToString

static fileToString(file: File): Observable<string|ArrayBuffer>

Convert a file to a string

serializeFile

static serializeFile(file: File): Observable<ClvFileModel>

Serialize a file for better use

buildDownloadFileUrl

static buildDownloadFileUrl(sanitizer: DomSanitizer, file: ClvFileModel): SafeResourceUrl

build the URL of a file to download it. In ts

const fileUrl = buildDownloadFileUrl(sanitizer, file);

In Html

<a [href]="fileUrl"  download="file.name">DownloadFile</a>

csvToJson

static csvToJson(csv: string) Convert from csv to json format

xlsxToJson

xlsxToJson(fileContent: string) Convert the contents of an excel file to json format.