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

@alitajs/autils

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alitajs/autils

Awesome Utils(前端常用工具方法)

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by81.25%
Maintainers
4
Weekly downloads
 
Created
Source

autils

Alita NPM version NPM downloads

小巧实用的前端工具类库。

特性

  • ✏️ TypeScript: 使用 TS 编写,类型友好
  • ✨ 源于项目:日常项目的积累
  • 🐳 严格测试:使用Jest对每个方法,进行严格的测试
  • ⚡️ 按需加载: 支持按需加载,请配合babel-plugin-import使用

使用

  1. 安装依赖
  • npm安装
npm install -D @alitajs/autils
  • yarn 安装(推荐)
yarn add @alitajs/autils
  1. 使用
import { numberToChinese } from '@alitajs/autils';

// 一
console.log(numberToChinese(1));

// 一万
console.log(numberToChinese(10000));

目录

📦 工具函数

  • Array
🔖🔖🔖🔖
arrayToObjectarrayToTreeassignassign

API

arrayToObject

将数组转换为对象

arrayToTree

将数组转换为树

numberToChinese

数字转中文工具方法 numberToChinese(number: number): string

  • 引入版本

0.0.1

  • 参数

number(number): 需要转换的数字

  • 返回值

(string): 转换后的文本

  • 例子
numberToChinese(1);
// => 一

按需加载

  • 安装 babel-plugin-import
yarn add --dev babel-plugin-import
  • 配置
// .babel.config.js

module.exports = function (api) {
  api.cache(true)

  const plugins = [
    [require.resolve('babel-plugin-import'), {
      libraryName: '@alitajs/autils',
      libraryDirectory: 'es',
      camel2DashComponentName: false
    }]
  ];

  return {
    plugins
  };
}

FAQs

Package last updated on 19 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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