mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
@@ -0,0 +1,10 @@
|
||||
import * as gtin from 'gtin';
|
||||
|
||||
gtin.isGTIN('12341238'); // $ExpectType boolean
|
||||
gtin.validate('12341238'); // $ExpectType boolean
|
||||
gtin.minify('0000012341238'); // $ExpectType string
|
||||
gtin.getFormat('12341238'); // $ExpectType GtinFormat
|
||||
gtin.getRealFormat('1234123412344'); // $ExpectType GtinFormat
|
||||
|
||||
gtin.upce.compress('1200000789'); // $ExpectType string | null
|
||||
gtin.upce.expand('127890'); // $ExpectType string
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for gtin 0.3
|
||||
// Project: https://github.com/xbpf/gtin
|
||||
// Definitions by: RafaelKr <https://github.com/RafaelKr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace gtin;
|
||||
|
||||
export type GtinFormat = 'GTIN-8' | 'GTIN-12' | 'GTIN-13' | 'GTIN-14';
|
||||
|
||||
export function isGTIN(gtin: string): boolean;
|
||||
export function validate(gtin: string): boolean;
|
||||
export function minify(gtin: string): string;
|
||||
export function getFormat(gtin: string): GtinFormat;
|
||||
export function getRealFormat(gtin: string): GtinFormat;
|
||||
|
||||
export namespace upce {
|
||||
function compress(gtin: string): string | null;
|
||||
function expand(gtin: string): string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"strictFunctionTypes": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gtin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user