@area17/a17-helpers

中文文档
3.3.2发布于 2024/11/27MITTypeScriptES Module零依赖近 30 天下载 1726

A js helper package

原始使用文档
文档目录13 节
  1. Introduction
  2. Setup
  3. Whats the difference?
  4. TypeScript
  5. Major revision notes:
  6. v2.0.0+
  7. v3.0.0+
  8. v3.1.0+
  9. v3.2.0+
  10. Documentation and demos
  11. Contribution
  12. Code of Conduct
  13. Tests

A17 JS Helpers

Introduction

A collection of documented vanilla JS widgets.

Originally written as we transitioned away from using jQuery and now just a useful time saver for

Setup

  1. Install via npm:
$ npm install @area17/a17-helpers

Import all helpers into your JavaScript by:

import helpers from '@area17/a17-helpers';

or, cherry pick individual helpers by either:

import { extend } from '@area17/a17-helpers';

or:

import extend from '@area17/a17-helpers/src/extend';

And then use the helper:

const obj1 = { foo: "bar", qux: "foobar" };
const obj2 = { foo: "baz" };
const merged_obj = extend(obj1, obj2);

Whats the difference?

Importing from @area17/a17-helpers with either import helpers from '@area17/a17-helpers' or import { extend } from '@area17/a17-helpers' will bring in all the JS helpers into your bundle and then you will need to use tree shaking in either Webpack or Rollup to remove helpers you don't use.

Cherry picking from the source file will bring in just the chosen helper and so you won't need to tree shake your production builds.

If you are using Webpack to compile your code and you are using it in production mode, it is likely doing this treeshaking and removing unused code for you automatically.

TypeScript

When modifying or creating JS helpers, dont forget to generate declaration files of your helpers so these can be imported into TS projects.

Please run : npm run types

This will add the declaration files at the same place of your JS files.

Major revision notes:

v2.0.0+

From v2.0.0 onwards drops IE11 support but maintains Safari 10+, Edge 12+, Chrome 24+ and FireFox 29+ support. If you need IE11 support use v1.0.3 and if you need IE9 level support, use v0.8.4.

v3.0.0+

oritentationChangeFix renamed to orientationChangeFix.

manageBehaviors and createBehaviors have been removed - behaviors and behavior management has been split out into its own library A17-Behaviors. fontLoadObserver removed, use https://github.com/zachleat/fontfaceonload lazyLoad removed, use use https://www.npmjs.com/package/@area17/a17-lazyload

v3.1.0+

Added:

v3.2.0+

Added:

Documentation and demos

Contribution

Feel free to add any vanilla JS helpers that will be common to many projects and save someone some time working them out in the future. The main aims are no dependencies, small elegant code and high potential sharing across sites.

Code of Conduct

AREA 17 is dedicated to building a welcoming, diverse, safe community. We expect everyone participating in the AREA 17 community to abide by our Code of Conduct. Please read it. Please follow it.

Tests

Written using Jest with tests in /test/. To run:

$ npm run test

版本与发布记录

@area17/a17-helpers 共发布 47 个版本,首次发布于 2018/02/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.3.2latest2024/11/272 年前
3.3.12024/02/172 年前
3.3.02024/02/172 年前
3.2.62024/01/302 年前
3.2.52024/01/302 年前
3.2.42024/01/252 年前

关于 @area17/a17-helpers 的常见问题

@area17/a17-helpers 是什么?

A js helper package

如何安装 @area17/a17-helpers?

在项目目录运行 npm install @area17/a17-helpers,或使用 pnpm add / yarn add / bun add。

@area17/a17-helpers 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@area17/a17-helpers 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@area17/a17-helpers 可以商用吗?

@area17/a17-helpers 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@area17/a17-helpers 的下载量有多少?

根据 npm 官方下载统计,@area17/a17-helpers 在 2026/10/07 – 2026/11/05 这 30 天内被下载 1,726 次,日均约 58 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@area17/a17-helpers 还在维护吗?

最新版本 3.3.2 发布于 2024/11/27(2 年前);至今共发布 47 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/02/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。