Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github-username-regex

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-username-regex

A regular expression that only matches a valid Github username

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6K
decreased by-27.6%
Maintainers
1
Weekly downloads
 
Created
Source

append-type

NPM version Bower version Build Status Coverage Status devDependencies Status

Stringify the value with appending its type: 10'10 (number)'

import appendType from 'append-type';

appendType('123'); //=> '123 (string)'
appendType(123); //=> '123 (number)'

Installation

npm

npm install append-type

bower

bower install append-type

API

appendType(value)

value: any type
Return: String

Essentially, it returns String(value) + ' (' + typeof value + ')'.

appendType(() => {}); //=> '() => {} (function)'

When it takes null / undefined, it returns 'null' / 'undefined'.

appendType(null); //=> 'null'
appendType(undefined); //=> 'undefined'

Example

This module is useful for making TypeError error messages.

function reverse(v) {
  if (typeof v !== 'boolean') {
    throw new TypeError(`Expected a Boolean value, but got ${appendType(v)}.`);
  }

  return !v;
};

reverse(1); //=> TypeError: Expected a Boolean value, but got 1 (number).

License

Copyright (c) 2016 Shinnosuke Watanabe

Licensed under the MIT License.

Keywords

FAQs

Package last updated on 17 Jan 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc