2
0
mirror of https://github.com/tenrok/numeralize-ru.git synced 2026-06-11 18:02:33 +03:00

Add Typescript typings

This commit is contained in:
anotherpit
2016-11-18 02:11:33 +03:00
parent 6d2367e447
commit 969110bd48
5 changed files with 52 additions and 4 deletions
-1
View File
@@ -106,4 +106,3 @@ pluralize(21, 'рубль', 'рубля', 'рублей');
# См.также
+ Подробно о склонении числительных в русском языке с примерами: http://numeralonline.ru/
+ TypeScript: https://github.com/types/npm-numeralize-ru
Vendored
+20
View File
@@ -0,0 +1,20 @@
export = numeralize;
declare function numeralize(number: number, gender?: numeralize.Gender, kase?: numeralize.Case, animate?: boolean): string;
declare namespace numeralize {
export type Gender = number;
export const GENDER_MASCULINE: Gender;
export const GENDER_FEMININE: Gender;
export const GENDER_NEUTER: Gender;
export type Case = number;
export const CASE_NOMINATIVE: Case;
export const CASE_GENITIVE: Case;
export const CASE_DATIVE: Case;
export const CASE_ACCUSATIVE: Case;
export const CASE_INSTRUMENTAL: Case;
export const CASE_PREPOSITIONAL: Case;
export function pluralize(count: number, one: string, two: string, five: string): string;
}
+6 -3
View File
@@ -1,10 +1,12 @@
{
"name": "numeralize-ru",
"version": "1.0.0",
"version": "1.0.1",
"description": "Russian numerals",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/mocha",
"test": "npm run test:js; npm run test:ts",
"test:js": "./node_modules/.bin/mocha",
"test:ts": "./node_modules/.bin/tsc ./test/*.d.spec.ts --noEmit --noImplicitAny --strictNullChecks --target ES6",
"dev": "./node_modules/.bin/mocha --watch"
},
"keywords": [
@@ -21,7 +23,8 @@
"author": "anotherpit <anotherpit@gmail.com>",
"license": "MIT",
"devDependencies": {
"mocha": "^2.4.5"
"mocha": "^2.4.5",
"typescript": "^2.0.10"
},
"repository": {
"type": "git",
+19
View File
@@ -0,0 +1,19 @@
import * as numeralize from '../index';
let g: numeralize.Gender;
g = numeralize.GENDER_MASCULINE;
g = numeralize.GENDER_FEMININE;
g = numeralize.GENDER_NEUTER;
let c: numeralize.Case;
c = numeralize.CASE_NOMINATIVE;
c = numeralize.CASE_GENITIVE;
c = numeralize.CASE_DATIVE;
c = numeralize.CASE_ACCUSATIVE;
c = numeralize.CASE_INSTRUMENTAL;
c = numeralize.CASE_PREPOSITIONAL;
let s: string;
s = numeralize(123, g, c, true);
s = numeralize.pluralize(123, 'рубль', 'рубля', 'рублей');
+7
View File
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"target": "es6"
}
}