Skip to main content
Version: 2.0.3

๐Ÿ’ก Introduction

NPM Latest Version

Idea

thiis package was created in order to simplify writing in typescript / javascript, it often happens that you need to have checks for different types of data, these checks can be "huge", but if you could simply describe in words what we want to check?

For example, why write:

Without thiis package
if (typeof variable === 'object' && variable !== null && !Array.isArray(variable) && Object.keys(variable)?.length) {
}

if you can write something like:

With thiis package
if (is.object_not_empty(variable)) {
}

Why you should use and support the package:โ€‹

  1. โœ… 60+ prepared methods, prefixed with _not_ more than 120 and with _or_ more than 14,000 and with a global state of more than 2,000,000 combined methods.
  2. โœ… Typification.
  3. โœ… Reducing the code in the project.
  4. โœ… Easier to read and understand the code.
  5. โœ… CDN support.
  6. โœ… Compatible with ECMAScript 2015.
  7. โœ… Compatible with the oldest version of TypeScript (0.8.0).
  8. โœ… Maintenance of global contexts: globalThis, window, self, global.
  9. โœ… No dependencies
  10. โœ… AMD, Node & browser ready
  11. โœ… Small size: ~8KB.
  12. โœ… Collection of RegExp patterns (33 items).
  13. โœ… Magic methods: is.len_, len_gt_N_lt_N, len_lt_N, len_gt_N, len_gte_N_lt_N, len_gte_N_lte_N, len_lte_N, len_gte_N, len_gt_N_lte_N
SizeMethodsPrefix .not.Unifier .or.CombinationsCombinations with globalCompatibility
~8KB60+โœ…โœ…14,000+2,000,000+Web + Node

Explanationโ€‹

Combinationโ€‹

It means that you can combine between the declared commands more than 14k times, for example: is.string_not_empty(), is.string_or_number() and so on. You can use non-combined commands, for example: is.string(), which will increase the performance of your code, or combine between commands, but then this effect will affect the productivity of the code, which indicates that you should not use combined commands in the most important parts of the code, for example, on the server , but for user-side applications will not lead to noticeable effects.

Combinations with globalโ€‹

Also, by default, the package has access to globally declared commands, this possibility can be blocked via IsConfig. This option allows you to write your own checking commands, for example, if you want to check whether $variable is a Map, you just need to write is.Map($variable) and you will get a result depending on whether $variable is of type Map or not (true, false). To explain, the Map method is not declared, it is generic, that is, by entering the name of the type, the package will look for this type in the global scope, and if it finds it, it will take it and use it for this: $variable instanceof Map.

Such possibilities in the package are limited only by the available types in the global scope, some of them are already declared in the interface (here is the link: Global Command) and for HTML types (here is the link HTML types). That is, in this way, if you know that there is some type declared globally, but it is not declared in the package, then there is nothing wrong, feel free to use it, the package will find it :)

๐Ÿ‘ค Contributingโ€‹

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request ๐Ÿ˜Ž

โœ๏ธ Authorsโ€‹

See also the list of contributors who participated in this project.

๐Ÿ“œ Licenseโ€‹

MIT License ยฉ Karbashevskyi