Socket
Socket
Sign inDemoInstall

typpy

Package Overview
Dependencies
2
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    typpy

A better typeof for JavaScript.


Version published
Maintainers
1
Install size
29.9 kB
Created

Readme

Source

typpy

typpy

Patreon PayPal AMA Travis Version Downloads Get help on Codementor

A better typeof for JavaScript.

:cloud: Installation

$ npm i --save typpy

:clipboard: Example

// Dependencies
var Typpy = require("typpy");

console.log(Typpy(0));
// => "number"

console.log(Typpy("", String));
// => true

console.log(Typpy.is(null, "null"));
// => true

console.log(Typpy.get([]));
// => Array

console.log(Typpy({}, true));
// => "object"

console.log(Typpy({}, Object));
// => true

:memo: Documentation

Typpy(input, target)

Gets the type of the input value or compares it with a provided type.

Usage:

Typpy({}) // => "object"
Typpy(42, Number); // => true
Typpy.get([], "array"); => true
Params
  • Anything input: The input value.
  • Constructor|String target: The target type. It could be a string (e.g. "array") or a constructor (e.g. Array).
Return
  • String|Boolean It returns true if the input has the provided type target (if was provided), false if the input type does not have the provided type target or the stringified type of the input (always lowercase).

Typpy.is(input, target)

Checks if the input value has a specified type.

Params
  • Anything input: The input value.
  • Constructor|String target: The target type. It could be a string (e.g. "array") or a constructor (e.g. Array).
Return
  • Boolean true, if the input has the same type with the target or false otherwise.

Typpy.get(input, str)

Gets the type of the input value. This is used internally.

Params
  • Anything input: The input value.
  • Boolean str: A flag to indicate if the return value should be a string or not.
Return
  • Constructor|String The input value constructor (if any) or the stringified type (always lowercase).

:yum: How to contribute

Have an idea? Found a bug? See how to contribute.

:moneybag: Donations

Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. :rocket:

PayPal donations are appreciated too! Each dollar helps.

Thanks! :heart:

:dizzy: Where is this library used?

If you are using this library in one of your projects, add it in this list. :sparkles:

  • animato—Simple way to animate anything (even simple values).
  • asyncer.js—Run groups of (a)sync functions.
  • babel-it—Babelify your code before npm publish.
  • barbe—Like mustache, but simple, tiny and fast.
  • blah—A command line tool to optimize the repetitive actions.
  • bloggify-ajs-renderer—ajs renderer for Bloggify.
  • bug-killer—Simple way to log messages in stdout or other stream.
  • cli-circle—Generate ASCII circles with NodeJS.
  • cli-gh-cal—GitHub like calendar graphs in command line.
  • color-it—Flat colors for your Node.js strings.
  • couleurs—Add some color and styles to your Node.JS strings.
  • deffy—Small and fast library to set default values.
  • diable—Daemonize the things out.
  • dom-repeater—Render lists in DOM easily.
  • elm-select—Select DOM elements and optionally call a function.
  • engine-builder (by jillix)—Engine composition parser.
  • engine-flow-types (by jillix)—Low level library providing Engine flow types.
  • engine-parser (by jillix)—Engine composition parser.
  • enny (by jillix)—Generate Engine compositions from human-readable inputs.
  • err—A tiny library to create custom errors in JavaScript.
  • exec-limiter—Limit the shell execution commands to calls same time.
  • flattenize—An experiment for converting images in flat equivalents.
  • gh-repos—Get one or all the owner repositories from GitHub.
  • ghcal—See the GitHub contributions calendar of a user in the command line.
  • ghosty—A wrapper around PhantomJS, downloading the Phantom binary.
  • git-stats—Local git statistics including GitHub-like contributions calendars.
  • git-stats-importer—Imports your commits from a repository into git-stats history.
  • limit-it—Run in parallel as many functions you want, but not more than functions at the time.
  • obj-flatten—Convert nested objects in flatten ones.
  • page-changed—Call a function when the page body is changed.
  • regarde—A tiny tool and library to watch commands.
  • scrape-it—A Node.js scraper for humans.
  • tilda—Tiny module for building command line tools.
  • transformer—Transform data using synchronous and asynchronous functions.
  • ul—A minimalist utility library.
  • validify—Validation made easy.
  • write-file-p—Create the directory structure and then create the file.

:scroll: License

MIT © Ionică Bizău

Keywords

FAQs

Last updated on 11 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc