0.3.15 • Published 2 months ago

@hyurl/utils v0.3.15

Weekly downloads
73
License
MIT
Repository
github
Last release
2 months ago

HyURL Utilities

Utility functions of HyURL collection.

This package currently contains the following functions, more functions may be included in the future. Each function is stored in a separated file.

Deprecated

Since v0.3.0, the following functions have been merged to @ayonli/jsext. The two packages serve different purposes, while @ayonli/jsext provides basic and semantic APIs for the JavaScript language, @hyurl/utils provides higher level functions that deal with objects.

This package still keeps a link to these functions, but they have been marked deprecated and will be removed in v0.4.0.

  • isFloat use isFloat from @ayonli/jsext/number instead.
  • isInteger use Number.isInteger instead.
  • isNumeric use isNumeric from @ayonli/jsext/number instead.
  • isBetween use isBetween from @ayonli/jsext/number instead.
  • isOwnKey use hasOwn from @ayonli/jsext/object instead.
  • isOwnMethod use hasOwnMethod from @ayonli/jsext/object instead.
  • isSubClassOf use jsext.isSubclassOf from @ayonli/jsext instead.
  • isVoid use !isValid from @ayonli/jsext/object instead.
  • omit use omit from @ayonli/jsext/object instead.
  • pick use pick from @ayonli/jsext/object instead.
  • omitVoid use omitInvalid instead.
  • rand use random from @ayonli/jsext/number instead.
  • randStr use random from @ayonli/jsext/string instead.
  • sleep use sleep from @ayonli/jsext/promise instead.
  • typeAs use as from @ayonli/jsext/object instead.
  • until use until from @ayonli/jsext/promise instead.
  • useThrottle use jsext.throttle from @ayonli/jsext instead.
  • wrap use jsext.wrap from @ayonli/jsext instead.

Import

There are many ways to import these functions.

All At Once

This method will load all functions into memory, even if you don't need some of them.

// Node.js
import * as utils from "@hyurl/utils";

// Deno
import * as utils from "https://lib.deno.dev/x/hyurl_utils@latest/index.ts";

// Browser
import * as utils from "https://lib.deno.dev/x/hyurl_utils@latest/esm/index.js";

Only Needed

This method will only load needed functions, which is recommended.

// Node.js
import count from "@hyurl/utils/count";
import ensureType from "@hyurl/utils/ensureType";

// Deno
import count from "https://lib.deno.dev/x/hyurl_utils@latest/count.ts";
import ensureType from "https://lib.deno.dev/x/hyurl_utils@latest/ensureType.ts";

// Browser
import count from "https://lib.deno.dev/x/hyurl_utils@latest/esm/count.js";
import ensureType from "https://lib.deno.dev/x/hyurl_utils@latest/esm/ensureType.js";

NOTE: Configure tsconfig.json to set compilerOptions.module as NodeNext or ESNext instead of CommonJS for this to work with Node.js+TypeScript.

Load Bundle (browser only)

<script src="https://lib.deno.dev/x/hyurl_utils@latest/bundle/index.js"></script>
<script>
    const utils = window["@hyurl/utils"];
<script>

Utilities Types

Other than utility functions, this package also provides some utility types for TypeScript, they are located in the following file and exposed to the global namespace.

import "@hyurl/utils/types";
0.3.15

2 months ago

0.3.14

2 months ago

0.3.13

4 months ago

0.3.12

4 months ago

0.3.0

8 months ago

0.3.6

7 months ago

0.3.5

7 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.4

7 months ago

0.3.3

8 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.2.26

1 year ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.50

4 years ago

0.1.45

4 years ago

0.1.44

4 years ago

0.1.43

4 years ago

0.1.41

4 years ago

0.1.42

4 years ago

0.1.40

4 years ago

0.1.35

4 years ago

0.1.34

4 years ago

0.1.33

4 years ago

0.1.31

4 years ago

0.1.32

4 years ago

0.1.30

4 years ago

0.1.27

4 years ago

0.1.28

4 years ago

0.1.26

4 years ago

0.1.25

4 years ago

0.1.23

4 years ago

0.1.24

4 years ago

0.1.22

4 years ago

0.1.20

4 years ago

0.1.21

4 years ago

0.1.14

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago