Skip to content

yanyue404/rainbow-shared

Repository files navigation

rainbow-shared

NPM version NPM monthly downloads  NPM total downloads

Utility functions for rainbow, based on @vue/shared

Install

npm i rainbow-shared -S

Usage

ES module

import { looseEqual } from "rainbow-shared";

console.log(looseEqual(["Hello, world!"], ["Hello, world!"])); // true

CommonJS

const { looseEqual } = require("rainbow-shared");

console.log(looseEqual(["Hello, world!"], ["Hello, world!"])); // true

CDN link

Packaged in iife mode to generate a global object R.

<!DOCTYPE html>
<html lang="en">
   <head>
     <meta charset="UTF-8" />
     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>rainbow-shared use cdn</title>
   </head>
   <body>
     <script src="https://cdn.jsdelivr.net/npm/rainbow-shared/dist/index.iife.js"></script>

     <script>
       console.log(R.looseEqual(["Hello,world!"], ["Hello,world!"])); // true
     </script>
   </body>
</html>

Support utils

You can check the function source code through cdn link for usage.

export {
   EMPTY_ARR,
   EMPTY_OBJ,
   NO,
   NOOP,
   addParamsToUrl,
   cacheObj,
   cacheStaticFn,
   camelize,
   capitalize,
   curry,
   debounce,
   deepClone,
   def,
   escapeHtml,
   escapeHtmlComment,
   extend,
   get,
   getGlobalThis,
   getObjValByAge,
   getQueryJson,
   getQueryString,
   hasChanged,
   hasOwn,
   hyphenate,
   invokeArrayFns,
   isArray,
   isDate,
   isDef,
   isEmpty,
   isFalse,
   isFunction,
   isHTMLTag,
   isMap,
   isModelListener,
   isObject,
   isOn,
   isPlainObject,
   isPrimitive,
   isPromise,
   isRegExp,
   isSet,
   isString,
   isSymbol,
   isTrue,
   isUndef,
   isUrl,
   loadCss,
   loadJs,
   looseEqual,
   looseIndexOf,
   makeMap,
   normalizeClass,
   normalizeProps,
   normalizeStyle,
   objectToString,
   once,
   parseStringStyle,
   promiseWrapper,
   remove,
   stringifyStyle,
   throttle,
   toArray,
   toDisplayString,
   toHandlerKey,
   toNumber,
   toObject,
   toRawType,
   toString,
   toTypeString,
   warn,
};

Reference

About

rainbow 的 实用函数, 基于 @vue/shared

Resources

Stars

Watchers

Forks

Packages

No packages published