forked from sheetjs/sheetjs
version bump 0.10.2: infrastructure
- typescript definitions - fixed vulnerable regexes (h/t @davisjam)
This commit is contained in:
parent
71f827c4fa
commit
f6de1799c4
18
.eslintrc
18
.eslintrc
@ -2,19 +2,23 @@
|
|||||||
"env": { "shared-node-browser":true },
|
"env": { "shared-node-browser":true },
|
||||||
"globals": {},
|
"globals": {},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 3,
|
"ecmaVersion": 3
|
||||||
},
|
},
|
||||||
"plugins": [ "html", "json" ],
|
"plugins": [ "html", "json" ],
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"comma-style": [ 2, "last" ],
|
||||||
|
"comma-dangle": [ 2, "never" ],
|
||||||
|
"curly": 0,
|
||||||
|
"no-bitwise": 0,
|
||||||
|
"no-console": 0,
|
||||||
|
"no-control-regex": 0,
|
||||||
|
"no-empty": 0,
|
||||||
|
"no-trailing-spaces": 2,
|
||||||
"no-use-before-define": [ 1, {
|
"no-use-before-define": [ 1, {
|
||||||
"functions":false, "classes":true, "variables":false
|
"functions":false, "classes":true, "variables":false
|
||||||
}],
|
}],
|
||||||
"no-bitwise": 0,
|
"no-useless-escape": 0,
|
||||||
"curly": 0,
|
"semi": [ 2, "always" ]
|
||||||
"comma-style": [ 2, "last" ],
|
|
||||||
"no-trailing-spaces": 2,
|
|
||||||
"semi": [ 2, "always" ],
|
|
||||||
"comma-dangle": [ 2, "never" ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,3 +27,8 @@ misc/flowdeps.js
|
|||||||
[options]
|
[options]
|
||||||
module.file_ext=.js
|
module.file_ext=.js
|
||||||
module.file_ext=.njs
|
module.file_ext=.njs
|
||||||
|
module.ignore_non_literal_requires=true
|
||||||
|
suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
deprecated-declare-exports=off
|
||||||
|
11
.npmignore
11
.npmignore
@ -13,20 +13,27 @@ tmp
|
|||||||
*.[pP][rR][nN]
|
*.[pP][rR][nN]
|
||||||
*.[sS][lL][kK]
|
*.[sS][lL][kK]
|
||||||
*.socialcalc
|
*.socialcalc
|
||||||
*.[xX][lL][sSwWcC]
|
*.[xX][lL][sSwWcCaAtTmM]
|
||||||
*.[xX][lL][sS][xXmMbB]
|
*.[xX][lL][sSaAtT][xXmMbB]
|
||||||
*.[oO][dD][sS]
|
*.[oO][dD][sS]
|
||||||
*.[fF][oO][dD][sS]
|
*.[fF][oO][dD][sS]
|
||||||
*.[xX][mM][lL]
|
*.[xX][mM][lL]
|
||||||
*.[uU][oO][sS]
|
*.[uU][oO][sS]
|
||||||
*.[wW][kKqQbB][S1234567890]
|
*.[wW][kKqQbB][S1234567890]
|
||||||
*.[qQ][pP][wW]
|
*.[qQ][pP][wW]
|
||||||
|
*.[bB][iI][fF][fF][23458]
|
||||||
|
*.[rR][tT][fF]
|
||||||
|
*.[eE][tT][hH]
|
||||||
*.123
|
*.123
|
||||||
*.htm
|
*.htm
|
||||||
*.html
|
*.html
|
||||||
*.sheetjs
|
*.sheetjs
|
||||||
*.exe
|
*.exe
|
||||||
|
*.img
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.gitattributes
|
||||||
|
.fossaignore
|
||||||
|
.spelling
|
||||||
.eslintrc
|
.eslintrc
|
||||||
.jshintrc
|
.jshintrc
|
||||||
Makefile
|
Makefile
|
||||||
|
9
.spelling
Normal file
9
.spelling
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ssf.js (C) 2013-present SheetJS -- http://sheetjs.com
|
||||||
|
SheetJS
|
||||||
|
ssf
|
||||||
|
|
||||||
|
ECMA-376
|
||||||
|
xls
|
||||||
|
xlsb
|
||||||
|
|
||||||
|
npm
|
19
Makefile
19
Makefile
@ -60,6 +60,9 @@ ctestserv: ## Start a test server on port 8000
|
|||||||
|
|
||||||
## Code Checking
|
## Code Checking
|
||||||
|
|
||||||
|
.PHONY: fullint
|
||||||
|
fullint: lint old-lint tslint flow mdlint ## Run all checks
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
|
lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
|
||||||
@eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
|
@eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
|
||||||
@ -68,13 +71,18 @@ lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
|
|||||||
.PHONY: old-lint
|
.PHONY: old-lint
|
||||||
old-lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
|
old-lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
|
||||||
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
|
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
|
||||||
@jshint --show-non-errors test/
|
|
||||||
@jshint --show-non-errors $(CMDS)
|
@jshint --show-non-errors $(CMDS)
|
||||||
@jshint --show-non-errors package.json
|
@jshint --show-non-errors package.json test/
|
||||||
@jshint --show-non-errors --extract=always $(HTMLLINT)
|
@jshint --show-non-errors --extract=always $(HTMLLINT)
|
||||||
@jscs $(TARGET) $(AUXTARGETS)
|
@jscs $(TARGET) $(AUXTARGETS) test/*.js
|
||||||
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
|
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
|
||||||
|
|
||||||
|
.PHONY: tslint
|
||||||
|
tslint: $(TARGET) ## Run typescript checks
|
||||||
|
#@npm install dtslint typescript
|
||||||
|
#@npm run-script dtslint
|
||||||
|
dtslint types
|
||||||
|
|
||||||
.PHONY: flow
|
.PHONY: flow
|
||||||
flow: lint ## Run flow checker
|
flow: lint ## Run flow checker
|
||||||
@flow check --all --show-all-errors
|
@flow check --all --show-all-errors
|
||||||
@ -97,6 +105,11 @@ full_coveralls:
|
|||||||
coveralls: ## Coverage Test + Send to coveralls.io
|
coveralls: ## Coverage Test + Send to coveralls.io
|
||||||
MINTEST=1 make full_coveralls
|
MINTEST=1 make full_coveralls
|
||||||
|
|
||||||
|
MDLINT=README.md
|
||||||
|
.PHONY: mdlint
|
||||||
|
mdlint: $(MDLINT) ## Check markdown documents
|
||||||
|
alex $^
|
||||||
|
mdspell -a -n -x -r --en-us $^
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
|
14
README.md
14
README.md
@ -1,6 +1,6 @@
|
|||||||
# [SheetJS SSF](http://sheetjs.com)
|
# [SheetJS SSF](http://sheetjs.com)
|
||||||
|
|
||||||
ssf (SpreadSheet Format) is a pure-JS library to format data using ECMA-376
|
ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376
|
||||||
spreadsheet format codes (used in popular spreadsheet software packages).
|
spreadsheet format codes (used in popular spreadsheet software packages).
|
||||||
|
|
||||||
|
|
||||||
@ -23,9 +23,8 @@ The browser exposes a variable `SSF`
|
|||||||
When installed globally, npm installs a script `ssf` that renders the format
|
When installed globally, npm installs a script `ssf` that renders the format
|
||||||
string with the given arguments. Running the script with `-h` displays help.
|
string with the given arguments. Running the script with `-h` displays help.
|
||||||
|
|
||||||
The script will manipulate `module.exports` if available (e.g. in a CommonJS
|
The script will manipulate `module.exports` if available . This is not always
|
||||||
`require` context). This is not always desirable. To prevent the behavior,
|
desirable. To prevent the behavior, define `DO_NOT_EXPORT_SSF`.
|
||||||
define `DO_NOT_EXPORT_SSF`.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ The options argument may contain the following keys:
|
|||||||
|
|
||||||
| Option Name | Default | Description |
|
| Option Name | Default | Description |
|
||||||
| :---------- | :-----: | :--------------------------------------------------- |
|
| :---------- | :-----: | :--------------------------------------------------- |
|
||||||
| date1904 | false | Use 1904 date system if true, 1900 system if false |
|
| `date1904` | false | Use 1904 date system if true, 1900 system if false |
|
||||||
|
|
||||||
### Manipulating the Internal Format Table
|
### Manipulating the Internal Format Table
|
||||||
|
|
||||||
@ -89,8 +88,9 @@ granted by the Apache 2.0 license are reserved by the Original Author.
|
|||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [ECMA-376] Office Open XML File Formats
|
- `ECMA-376`: Office Open XML File Formats
|
||||||
- [MS-XLSB] Excel (.xlsb) Binary File Format
|
- `MS-XLS`: Excel Binary File Format (.xls) Structure Specification
|
||||||
|
- `MS-XLSB`: Excel (.xlsb) Binary File Format
|
||||||
|
|
||||||
## Badges
|
## Badges
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
/* eslint no-console:0 */
|
/* eslint no-console:0 */
|
||||||
|
/*jshint node:true */
|
||||||
var X = require('../');
|
var X = require('../');
|
||||||
var argv = process.argv.slice(2);
|
var argv = process.argv.slice(2);
|
||||||
if(argv.length < 2 || argv[0] == "-h" || argv[0] == "--help") {
|
if(argv.length < 2 || argv[0] == "-h" || argv[0] == "--help") {
|
||||||
|
@ -1 +1 @@
|
|||||||
SSF.version = '0.10.1';
|
SSF.version = '0.10.2';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var cfregex = /\[[=<>]/;
|
var cfregex = /\[[=<>]/;
|
||||||
var cfregex2 = /\[([=<>]*)(-?\d+\.?\d*)\]/;
|
var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
|
||||||
function chkcond(v, rr) {
|
function chkcond(v, rr) {
|
||||||
if(rr == null) return false;
|
if(rr == null) return false;
|
||||||
var thresh = parseFloat(rr[2]);
|
var thresh = parseFloat(rr[2]);
|
||||||
|
@ -27,6 +27,7 @@ a { text-decoration: none }
|
|||||||
<script>
|
<script>
|
||||||
/*jshint browser:true */
|
/*jshint browser:true */
|
||||||
/*eslint-env browser */
|
/*eslint-env browser */
|
||||||
|
/*eslint no-use-before-define:0 */
|
||||||
/*global SSF */
|
/*global SSF */
|
||||||
var F = document.getElementById('fmt');
|
var F = document.getElementById('fmt');
|
||||||
var V = document.getElementById('val');
|
var V = document.getElementById('val');
|
||||||
@ -55,8 +56,6 @@ if(F.addEventListener) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var _gaq = _gaq || [];
|
var _gaq = _gaq || [];
|
||||||
_gaq.push(['_setAccount', 'UA-36810333-1']);
|
_gaq.push(['_setAccount', 'UA-36810333-1']);
|
||||||
_gaq.push(['_trackPageview']);
|
_gaq.push(['_trackPageview']);
|
||||||
|
19
package.json
19
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ssf",
|
"name": "ssf",
|
||||||
"version": "0.10.1",
|
"version": "0.10.2",
|
||||||
"author": "sheetjs",
|
"author": "sheetjs",
|
||||||
"description": "Format data using ECMA-376 spreadsheet Format Codes",
|
"description": "Format data using ECMA-376 spreadsheet Format Codes",
|
||||||
"keywords": [ "format", "sprintf", "spreadsheet" ],
|
"keywords": [ "format", "sprintf", "spreadsheet" ],
|
||||||
@ -8,24 +8,31 @@
|
|||||||
"ssf": "./bin/ssf.njs"
|
"ssf": "./bin/ssf.njs"
|
||||||
},
|
},
|
||||||
"main": "./ssf",
|
"main": "./ssf",
|
||||||
|
"types": "types",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"frac":"~1.1.0"
|
"frac":"~1.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha":"~2.5.3",
|
"mocha": "~2.5.3",
|
||||||
"blanket": "~1.2.3",
|
"blanket": "~1.2.3",
|
||||||
"@sheetjs/uglify-js":"~2.7.3"
|
"@sheetjs/uglify-js":"~2.7.3",
|
||||||
|
"@types/node":"^8.0.7",
|
||||||
|
"dtslint": "^0.1.2",
|
||||||
|
"typescript": "2.2.0"
|
||||||
},
|
},
|
||||||
"repository": { "type":"git", "url":"git://github.com/SheetJS/ssf.git" },
|
"repository": { "type":"git", "url":"git://github.com/SheetJS/ssf.git" },
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "make test"
|
"test": "make test",
|
||||||
|
"build": "make",
|
||||||
|
"lint": "make fullint",
|
||||||
|
"dtslint": "dtslint types"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"blanket": {
|
"blanket": {
|
||||||
"pattern": "ssf.js"
|
"pattern": "ssf.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"homepage": "https://oss.sheetjs.com/ssf",
|
"homepage": "http://sheetjs.com/opensource",
|
||||||
"bugs": { "url": "https://github.com/SheetJS/ssf/issues" },
|
"bugs": { "url": "https://github.com/SheetJS/ssf/issues" },
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"engines": { "node": ">=0.8" }
|
"engines": { "node": ">=0.8" }
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*:: declare var DO_NOT_EXPORT_SSF: any; */
|
/*:: declare var DO_NOT_EXPORT_SSF: any; */
|
||||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||||
SSF.version = '0.10.1';
|
SSF.version = '0.10.2';
|
||||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||||
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||||
@ -793,7 +793,7 @@ function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
|||||||
}
|
}
|
||||||
SSF._eval = eval_fmt;
|
SSF._eval = eval_fmt;
|
||||||
var cfregex = /\[[=<>]/;
|
var cfregex = /\[[=<>]/;
|
||||||
var cfregex2 = /\[([=<>]*)(-?\d+\.?\d*)\]/;
|
var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
|
||||||
function chkcond(v, rr) {
|
function chkcond(v, rr) {
|
||||||
if(rr == null) return false;
|
if(rr == null) return false;
|
||||||
var thresh = parseFloat(rr[2]);
|
var thresh = parseFloat(rr[2]);
|
||||||
|
4
ssf.js
4
ssf.js
@ -3,7 +3,7 @@
|
|||||||
/*jshint -W041 */
|
/*jshint -W041 */
|
||||||
var SSF = ({});
|
var SSF = ({});
|
||||||
var make_ssf = function make_ssf(SSF){
|
var make_ssf = function make_ssf(SSF){
|
||||||
SSF.version = '0.10.1';
|
SSF.version = '0.10.2';
|
||||||
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||||
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
||||||
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||||
@ -783,7 +783,7 @@ out[i].v = write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0);
|
|||||||
}
|
}
|
||||||
SSF._eval = eval_fmt;
|
SSF._eval = eval_fmt;
|
||||||
var cfregex = /\[[=<>]/;
|
var cfregex = /\[[=<>]/;
|
||||||
var cfregex2 = /\[([=<>]*)(-?\d+\.?\d*)\]/;
|
var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
|
||||||
function chkcond(v, rr) {
|
function chkcond(v, rr) {
|
||||||
if(rr == null) return false;
|
if(rr == null) return false;
|
||||||
var thresh = parseFloat(rr[2]);
|
var thresh = parseFloat(rr[2]);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* vim: set ts=2: */
|
/* vim: set ts=2: */
|
||||||
/*jshint loopfunc:true, mocha:true, node:true */
|
/*jshint loopfunc:true, mocha:true, node:true */
|
||||||
var SSF = require('../');
|
var SSF = require('../');
|
||||||
var fs = require('fs'), assert = require('assert');
|
var assert = require('assert');
|
||||||
describe('dateNF override', function() {
|
describe('dateNF override', function() {
|
||||||
it('should override format code 14', function() {
|
it('should override format code 14', function() {
|
||||||
assert.equal(SSF.format(14, 43880), "2/19/20");
|
assert.equal(SSF.format(14, 43880), "2/19/20");
|
||||||
|
5
types/.npmignore
Normal file
5
types/.npmignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Makefile
|
||||||
|
*ssf*.ts
|
||||||
|
doc.ts
|
||||||
|
write.ts
|
||||||
|
tslint.json
|
13
types/bin_ssf.ts
Executable file
13
types/bin_ssf.ts
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||||
|
/* eslint-env node */
|
||||||
|
/* eslint no-console:0 */
|
||||||
|
/*jshint node:true */
|
||||||
|
/// <reference types="../node_modules/@types/node/" />
|
||||||
|
import X = require('ssf');
|
||||||
|
const argv = process.argv.slice(2);
|
||||||
|
if(argv.length < 2 || argv[0] === "-h" || argv[0] === "--help") {
|
||||||
|
console.error("usage: ssf <format> <value>");
|
||||||
|
console.error("output: format_as_string|format_as_number|");
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
console.log(X.format(argv[0],argv[1]) + "|" + X.format(argv[0],+(argv[1])) + "|");
|
56
types/index.d.ts
vendored
Normal file
56
types/index.d.ts
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||||
|
// TypeScript Version: 2.2
|
||||||
|
|
||||||
|
/** Version string */
|
||||||
|
export const version: string;
|
||||||
|
|
||||||
|
/** Render value using format string or code */
|
||||||
|
export function format(fmt: string|number, val: any, opts?: any): string;
|
||||||
|
|
||||||
|
/** Load format string */
|
||||||
|
export function load(fmt: string, idx?: number): number;
|
||||||
|
|
||||||
|
/** Test if the format is a Date format */
|
||||||
|
export function is_date(fmt: string): boolean;
|
||||||
|
|
||||||
|
|
||||||
|
/** Format Table */
|
||||||
|
export interface SSF$Table {
|
||||||
|
[key: number]: string;
|
||||||
|
[key: string]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get format table */
|
||||||
|
export function get_table(): SSF$Table;
|
||||||
|
|
||||||
|
/** Set format table */
|
||||||
|
export function load_table(tbl: SSF$Table): void;
|
||||||
|
|
||||||
|
|
||||||
|
/** Parsed date */
|
||||||
|
export interface SSF$Date {
|
||||||
|
/** number of whole days since relevant epoch, 0 <= D */
|
||||||
|
D: number;
|
||||||
|
/** integral year portion, epoch_year <= y */
|
||||||
|
y: number;
|
||||||
|
/** integral month portion, 1 <= m <= 12 */
|
||||||
|
m: number;
|
||||||
|
/** integral day portion, subject to gregorian YMD constraints */
|
||||||
|
d: number;
|
||||||
|
/** integral day of week (0=Sunday .. 6=Saturday) 0 <= q <= 6 */
|
||||||
|
q: number;
|
||||||
|
|
||||||
|
/** number of seconds since midnight, 0 <= T < 86400 */
|
||||||
|
T: number;
|
||||||
|
/** integral number of hours since midnight, 0 <= H < 24 */
|
||||||
|
H: number;
|
||||||
|
/** integral number of minutes since the last hour, 0 <= M < 60 */
|
||||||
|
M: number;
|
||||||
|
/** integral number of seconds since the last minute, 0 <= S < 60 */
|
||||||
|
S: number;
|
||||||
|
/** sub-second part of time, 0 <= u < 1 */
|
||||||
|
u: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parse numeric date code */
|
||||||
|
export function parse_date_code(v: number, opts?: any): SSF$Date;
|
16
types/ssf-test.ts
Normal file
16
types/ssf-test.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { format, load, get_table, load_table, parse_date_code, is_date, SSF$Table, SSF$Date } from 'ssf';
|
||||||
|
|
||||||
|
const t1: string = format("General", 123.456);
|
||||||
|
const t2: string = format(0, 234.567);
|
||||||
|
const t3: string = format("@", "1234.567");
|
||||||
|
|
||||||
|
load('"This is "0.00', 70);
|
||||||
|
load('"This is "0');
|
||||||
|
|
||||||
|
const tbl: SSF$Table = get_table();
|
||||||
|
load_table(tbl);
|
||||||
|
|
||||||
|
const date: SSF$Date = parse_date_code(43150);
|
||||||
|
const sum: number = date.D + date.T + date.y + date.m + date.d + date.H + date.M + date.S + date.q + date.u;
|
||||||
|
|
||||||
|
const isdate: boolean = is_date("YYYY-MM-DD");
|
14
types/tsconfig.json
Normal file
14
types/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"lib": [ "es5" ],
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"strictNullChecks": false,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": { "ssf": ["."] },
|
||||||
|
"types": [],
|
||||||
|
"noEmit": true,
|
||||||
|
"forceConsistentCasingInFileNames": true
|
||||||
|
}
|
||||||
|
}
|
11
types/tslint.json
Normal file
11
types/tslint.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "dtslint/dtslint.json",
|
||||||
|
"rules": {
|
||||||
|
"whitespace": false,
|
||||||
|
"no-sparse-arrays": false,
|
||||||
|
"only-arrow-functions": false,
|
||||||
|
"no-consecutive-blank-lines": false,
|
||||||
|
"prefer-conditional-expression": false,
|
||||||
|
"one-variable-per-declaration": false
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user