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

@f5devcentral/atg-shared-utilities-dev

v0.2.17

Published

This project holds a number of generic utility functions that can be shared across the F5 Automation Toolchain projects.

Downloads

7,598

Readme

atg-shared-utilities-dev

This project holds a number of developer utility functions that can be shared across the F5 Automation Toolchain projects.

CONTRIBUTIONS

Read through the contributing/README.md for information on how to contribute to this project.

checkAndDelete

These are quick functions, which checks to see if a property exists in an object, then if it is of the specified type, and finally deletes it. It was designed for use in testing properties with random values within arrays of objects.

By checking for their existance and then deleting them, the user can then use assert.strictDeepEquals(...) more reliably.

checkAndDeleteProperty(objectToCheck, propertyToCheck, expectedPropertyType, options)

This function is primarily useful in integration and unit testing. Where some of the values returned are randomized. This allows for the randomness to happen then it validates the return value is both present and of the expected type. Then by removing it, testing can then do a deep comparison of the expected values.

Example properties: automatically generated ids, runtimes, and dates.

This takes in an object or an array of objects, checks each object for the property, checks the property's type against the expected value, and then deletes the property from the object.

This does not check nested objects for the "propertyToCheck".

This throws an error if the propertyToCheck is not found, or the typeof the property does not match the expectedPropertyType.

  • objectToCheck : The object that is being checked.
  • propertyToCheck : The name of the property to be checked.
  • expectedPropertyType : The type the property is expected to equal.
  • options : An object which holds options that changes how this function behaves (see below).

WARNING: At the moment, due to the copying process in this function, objects with "undefined" property values will not appear in the returned object.

options

These are optional values that do NOT need to be included in the method call.

  • skipUndefinedProperties : Options to loosen the error checking if a property is not always available in every object in the array.

options.skipUndefinedProperties

This option accepts one of the following strings.

  • "MIN0": Skips check if objectToCheck[propertyToCheck] is undefined. Formerly the isMissingProp.
  • "MIN1": Skips check if objectToCheck[propertyToCheck] is undefined, but Errors if ALL object[propertyToCheck] are undefined.

examples

const result = checkAndDeleteProperty({ foo: 'bar' }, 'foo', 'string'); // removes foo from the object const resultArray = checkAndDeleteProperty([{ foo: 'bar' }, { foo: 'bar' }], 'foo', 'string'); // removes foo from both objects

SCRIPTS

scripts/write-copyright.js

Adds the copyright template with current year to the top of every file in src/, scripts/, and test/.

To use: run from project root, after installing package:
node node_modules/@f5devcentral/atg-shared-utilities-dev/scripts/dev/write-copyright.js [-p <optional-path-to-copyright>]

You can provide your own copyright text as an argument in the call with the -p option. If you do not include one, the script will default to using its own located at: node_modules/@f5devcentral/atg-shared-utilities-dev/scripts/dev/copyright.txt

CICD Mode

This script can be run as a CICD pipeline check by enabling the CICD mode (-c argument).

  • Process will abort pipeline if an outdated copyright is found.
  • Process will exit gracefully if no outdated copyrights are found.

To use: run from project root, after installing package:
node node_modules/@f5devcentral/atg-shared-utilities-dev/scripts/dev/write-copyright.js -c

Note: This can be used with the -p option and vice versa.

License

Apache License 2.0

Copyright

Copyright 2014-2021 F5 Networks Inc.