New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

to-chinese-numeral

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-chinese-numeral - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

LICENSE

2

dist/index.js
"use strict";
function toChineseNumeral(num) {
if (typeof num !== "number") {
if (typeof num !== "number" || Number.isNaN(num)) {
throw new TypeError("Not a number");

@@ -5,0 +5,0 @@ }

{
"name": "to-chinese-numeral",
"version": "0.1.0",
"version": "0.2.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A function that takes a Number as its argument and returns a Chinese numeral string.",

@@ -0,1 +1,3 @@

![Jest Tests](https://github.com/mornir/to-chinese-numeral/workflows/Jest%20Tests/badge.svg?branch=master) [![NPM](https://nodei.co/npm/to-chinese-numeral.png?mini=true)](https://npmjs.org/package/to-chinese-numeral)
# to-chinese-numeral

@@ -20,3 +22,3 @@

const num = toChineseNumeral(156)
// num =
// num = 一百五十六
} catch (error) {

@@ -35,2 +37,2 @@ console.error(error.message)

This package was inspired by a [challenge](https://www.codewars.com/kata/52608f5345d4a19bed000b31/train/javascript) on [codewars.com](https://www.codewars.com/)
This package was inspired by a [challenge](https://www.codewars.com/kata/52608f5345d4a19bed000b31/train/javascript) on [codewars.com](https://www.codewars.com/).
function toChineseNumeral(num: number) {
if (typeof num !== "number") {
if (typeof num !== "number" || Number.isNaN(num)) {
throw new TypeError("Not a number")

@@ -4,0 +4,0 @@ }

@@ -39,2 +39,10 @@ const toChineseNumeral = require("../dist/index.js")

expect(() => {
toChineseNumeral(NaN)
}).toThrow(TypeError)
expect(() => {
toChineseNumeral("")
}).toThrow(TypeError)
expect(() => {
toChineseNumeral(56896325)

@@ -41,0 +49,0 @@ }).toThrow(RangeError)

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