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

lil-type

v0.1.2

Published

Modern, reliable, full featured, type checking helpers

Downloads

9

Readme

lil'-type Build Status Stories in Ready Code Climate Gitter chat

Modern, reliable, full featured, type checking helpers (based on hu)

Features

  • Full type-checking support
  • Support upcoming ES6 data types (Generators, Promise, Map, WeakMap...)
  • Support for binary data types (Blob, File, FileReader...)
  • Support for buffer data types (ArrayBuffer, DataView...)
  • Support for typed arrays (Int8Array, Float32Array...)
  • Smart type inference

Installation

Node.js

npm install lil-type

Browser

Via Bower

bower install lil-type

Via Component

component install lil-js/type

Or loading the script remotely

<script src="//cdn.rawgit.com/lil-js/type/0.1.2/type.js"></script>

Environments

  • Node.js
  • Chrome >= 5
  • Firefox >= 3
  • Safari >= 5
  • Opera >= 10
  • IE >= 9

Usage

You could fetch de module via require() if it's available. Otherwise, global fallback will be used, exposed via lil.type

var lil = require('lil-type')
Type checking
lil.isObject({}) // -> true
lil.isArray([1,2,3]) // -> true
lil.isNumber(1.2) // -> true
lil.isBool(1.2) // -> true
lil.isRegExp(/[a-z]/) // -> true
Content checking
lil.isEmpty(void 0) // -> true
lil.isEmpty('') // -> true
lil.isEmpty([]) // -> true
lil.isEmpty({}) // -> true
lil.isEmpty(1.5) // -> false
lil.isEmpty(new Date) // -> false
Getting data type
lil.is('name') // -> 'string'
lil.is({}) // -> 'object'
lil.is([1]) // -> 'array'
lil.is(/[a-z]/) // -> 'regexp'
lil.is(function () {}) // -> 'function'
lil.is(void 0) // -> 'undefined'
Type handle helpers
lil.isIterable([1,2,3]) // -> true
lil.isIterable({ name: 'Chuck' }) // -> true
lil.isIterable(function () {}) // -> false
lil.isIterable(true) // -> false
lil.isMutable({}) // -> true
lil.isMutable([]) // -> true
lil.isMutable('') // -> false
lil.isMutable(/[a-z]/) // -> false

API

lil.isBool(o)

Alias: isBoolean

lil.isNumber(o)

lil.isNaN(o)

lil.isFinite(o)

lil.isString(o)

lil.isDate(o)

lil.isRegExp(o)

lil.isError(o)

lil.isFn(o)

Alias: isFunction

lil.isArguments(o)

lil.isSymbol(o)

lil.isArray(o)

lil.isTypedArray(o)

lil.isObject(o)

lil.isPlainObject(o)

lil.isElement(o)

lil.isNull(o)

lil.isUndefined(o)

lil.isPromise(o)

lil.isGenerator(o)

lil.isMap(o)

lil.isBinary(o)

lil.isBlob(o)

lil.isFile(o)

lil.isBuffer(o)

lil.isEmpty(o)

lil.notEmpty(o)

lil.isIterable(o)

lil.isPrimitive(o)

lil.isMutable(o)

lil.is(o)

Alias: isType

lil.type.VERSION

Contributing

Wanna help? Cool! It will be appreciated :)

You must add new test cases for any new feature or refactor you do, always following the same design/code patterns that already exist

Development

Only node.js is required for development

Clone the repository

$ git clone https://github.com/lil-js/type.git && cd type

Install dependencies

$ npm install

Generate browser bundle source

$ make browser

Run tests

$ make test

License

MIT © Tomas Aparicio