{"id":13443,"library":"licia","title":"Licia Utility Collection","description":"Licia is a zero-dependency JavaScript utility library providing over 400 micro modules for common daily development tasks. Unlike monolithic libraries, Licia's design philosophy focuses on individual, 'deadly simple' modules addressing problems across various domains, rather than strict categorization. It includes functionalities like a jQuery-style DOM module, a cookie library, robust `dateFormat`, a Promise polyfill, a micro event emitter, Ajax/fetch utilities, and common helpers found in libraries like Lodash/Underscore (e.g., `shuffle`, `unique`, `mkdir`). The current stable version is `1.48.0`, with a frequent release cadence, typically receiving minor updates every one to two weeks. For projects requiring ES module imports and optimized bundle sizes, the companion `licia-es` package is recommended, or users can leverage the online builder tool to create custom utility bundles.","status":"active","version":"1.48.0","language":"javascript","source_language":"en","source_url":"https://github.com/liriliri/licia","tags":["javascript","eustia","util","typescript"],"install":[{"cmd":"npm install licia","lang":"bash","label":"npm"},{"cmd":"yarn add licia","lang":"bash","label":"yarn"},{"cmd":"pnpm add licia","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Licia utilities are exposed as individual CommonJS modules. For ESM, use `licia-es/uuid`.","wrong":"import { uuid } from 'licia';","symbol":"uuid","correct":"const uuid = require('licia/uuid');"},{"note":"The DOM manipulation utility is accessed via `licia/$`. For ESM, use `licia-es/$`.","wrong":"import { $ } from 'licia';","symbol":"$","correct":"const $ = require('licia/$');"},{"note":"Individual utilities are imported directly by path. For ESM, use `licia-es/dateFormat`.","wrong":"const { dateFormat } = require('licia');","symbol":"dateFormat","correct":"const dateFormat = require('licia/dateFormat');"}],"quickstart":{"code":"import { name, random } from 'licia-es';\nimport isStr from 'licia-es/isStr';\nconst uuid = require('licia/uuid');\nconst { each } = require('licia/collection');\n\nconsole.log(`Generated UUID: ${uuid()}`);\nconsole.log(`Is 'hello' a string? ${isStr('hello')}`);\n\nconst items = [1, 2, 3];\neach(items, (item, idx) => {\n  console.log(`Item at index ${idx}: ${item}`);\n});\n\nconsole.log(`Random number between 0 and 100: ${random(0, 100)}`);\nconsole.log(`Package name: ${name()}`);\n","lang":"typescript","description":"Demonstrates importing utilities from both the primary CommonJS `licia` package and the ESM-focused `licia-es` package for various common tasks like UUID generation, type checking, iteration, and random number generation."},"warnings":[{"fix":"For CommonJS environments, use `const util = require('licia/utilName')`. For ES Modules, install `licia-es` and use `import util from 'licia-es/utilName'`.","message":"The `licia` package is primarily distributed as CommonJS modules, with each utility residing in its own file (e.g., `licia/uuid`). Attempting to use named ESM imports like `import { uuid } from 'licia'` directly will likely fail or lead to inefficient bundling. For proper ES module support and optimal tree-shaking, developers should use the dedicated `licia-es` package (e.g., `import uuid from 'licia-es/uuid'`).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review all usages of the `fileSize` utility after updating to `v1.46.0` or newer. Adjust your application's expectations or add unit conversions if you were relying on a different default output unit in earlier versions.","message":"The `fileSize` utility in `v1.46.0` changed its behavior to explicitly 'turn back to bytes', meaning previous versions might have returned file sizes in different default units (e.g., KB, MB). Applications relying on the previous default unit of `fileSize` will receive values in bytes after updating.","severity":"breaking","affected_versions":"<1.46.0"},{"fix":"Update `licia` to `v1.41.1` or a newer version to ensure correct `randomId` generation, especially when requesting IDs longer than 21 characters.","message":"The `randomId` function in versions prior to `v1.41.1` had a bug where generating IDs with a `size` parameter greater than 21 could result in incorrect or truncated output due to an underlying integer overflow issue.","severity":"gotcha","affected_versions":"<1.41.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"For ESM, install `licia-es` and use `import uuid from 'licia-es/uuid'`. For CommonJS, use `const uuid = require('licia/uuid')`.","cause":"Attempting to use `import { uuid } from 'licia'` in a modern bundler environment. The main `licia` package exports individual CommonJS modules, not named ESM exports from the root.","error":"TypeError: (0 , _licia_uuid__WEBPACK_IMPORTED_MODULE_0__.default) is not a function"},{"fix":"Access the utility directly via its module path: `const uuid = require('licia/uuid')`.","cause":"Incorrectly trying to access a utility (e.g., `uuid`) as a property of the main `licia` export, like `require('licia').uuid`, when utilities are exposed as individual modules.","error":"Cannot read properties of undefined (reading 'uuid')"},{"fix":"Run `npm install licia` or `yarn add licia` to add the package to your project.","cause":"The `licia` package has not been installed or is not correctly linked in the project's dependencies.","error":"Module not found: Error: Can't resolve 'licia'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}