Added gematriya types (#37361)

This commit is contained in:
Mendy Berger
2019-08-05 12:41:49 -07:00
committed by Nathan Shively-Sanders
parent a0f0663dfa
commit aeafe3ea2d
5 changed files with 59 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for gematriya 2.0
// Project: https://github.com/Scimonster/js-gematriya
// Definitions by: Mendy Berger <https://github.com/MendyBerger>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare global {
function gematriya(num: number, options?: { limit?: number, punctuate?: boolean, geresh?: boolean }): string;
function gematriya(str: string, options?: { order?: boolean }): number;
}
export = gematriya;
@@ -0,0 +1,11 @@
gematriya(5774); // $ExpectType string
gematriya(5774, {limit: 3}); // $ExpectType string
gematriya(5774, {limit: 7}); // $ExpectType string
gematriya(5774, {punctuate: false}); // $ExpectType string
gematriya(5774, {punctuate: true}); // $ExpectType string
gematriya(5774, {geresh: false}); // $ExpectType string
gematriya(5774, {punctuate: false, limit: 3}); // $ExpectType string
gematriya(3); // $ExpectType string
gematriya(3, {geresh: false}); // $ExpectType string
gematriya('התשעד', {order: true}); // $ExpectType number
gematriya('התשעד', {order: false}); // $ExpectType number
@@ -0,0 +1,13 @@
import gematriya = require("gematriya");
gematriya(5774); // $ExpectType string
gematriya(5774, {limit: 3}); // $ExpectType string
gematriya(5774, {limit: 7}); // $ExpectType string
gematriya(5774, {punctuate: false}); // $ExpectType string
gematriya(5774, {punctuate: true}); // $ExpectType string
gematriya(5774, {geresh: false}); // $ExpectType string
gematriya(5774, {punctuate: false, limit: 3}); // $ExpectType string
gematriya(3); // $ExpectType string
gematriya(3, {geresh: false}); // $ExpectType string
gematriya('התשעד', {order: true}); // $ExpectType number
gematriya('התשעד', {order: false}); // $ExpectType number
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"test/gematriya-module-tests.ts",
"test/gematriya-global-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }