@f5devcentral/atg-shared-utilities-dev

中文文档
0.2.26发布于 2026/09/01Apache-2.0CommonJS零依赖近 30 天下载 4357

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

原始使用文档
文档目录7 节
  1. CONTRIBUTIONS
  2. checkAndDelete
  3. checkAndDeleteProperty(objectToCheck, propertyToCheck, expe…
  4. SCRIPTS
  5. scripts/write-copyright.js
  6. License
  7. Copyright

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
  • propertyToCheck : The name of the property to be checked.
  • expectedPropertyType : The type the property is expected to equal.
  • options

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 2014-2021 F5 Networks Inc.

版本与发布记录

@f5devcentral/atg-shared-utilities-dev 共发布 28 个版本,首次发布于 2021/03/16;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.2.26latest2026/09/012 个月前
0.2.252026/04/176 个月前
0.2.242026/01/1010 个月前
0.2.232026/01/1010 个月前
0.2.222025/10/041.1 年前
0.2.212025/02/211.7 年前

关于 @f5devcentral/atg-shared-utilities-dev 的常见问题

@f5devcentral/atg-shared-utilities-dev 是什么?

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

如何安装 @f5devcentral/atg-shared-utilities-dev?

在项目目录运行 npm install @f5devcentral/atg-shared-utilities-dev,或使用 pnpm add / yarn add / bun add。

@f5devcentral/atg-shared-utilities-dev 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/f5devcentral__atg-shared-utilities-dev 是否存在。

@f5devcentral/atg-shared-utilities-dev 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@f5devcentral/atg-shared-utilities-dev 可以商用吗?

@f5devcentral/atg-shared-utilities-dev 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@f5devcentral/atg-shared-utilities-dev 的下载量有多少?

根据 npm 官方下载统计,@f5devcentral/atg-shared-utilities-dev 在 2026/10/14 – 2026/11/12 这 30 天内被下载 4,357 次,日均约 145 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@f5devcentral/atg-shared-utilities-dev 还在维护吗?

最新版本 0.2.26 发布于 2026/09/01(2 个月前);至今共发布 28 个版本,其中过去 12 个月发布了 4 个;首次发布于 2021/03/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。