Forked with intention of open source contribution. 📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Go to file
SheetJS d31879d702 version bump 0.5.0: cleanup
- removed ssf_node.js: scripts should define DO_NOT_EXPORT_SSF to prevent export
- added ssf binary
- updated frac to 0.3.0
- entire table can be pulled and saved
- choose_fmt and format functions can take an external table
- LICENSE year updated
- removed unused tests
2014-01-10 14:09:11 -05:00
bin version bump 0.5.0: cleanup 2014-01-10 14:09:11 -05:00
test version bump 0.4.0: improvements across the board 2013-12-26 17:35:42 -05:00
.travis.yml Initial commit 2013-12-06 11:49:25 -05:00
LICENSE version bump 0.5.0: cleanup 2014-01-10 14:09:11 -05:00
Makefile version bump 0.2.1: more support for implied types 2013-12-13 22:28:57 -05:00
package.json version bump 0.5.0: cleanup 2014-01-10 14:09:11 -05:00
README.md version bump 0.5.0: cleanup 2014-01-10 14:09:11 -05:00
ssf.js version bump 0.5.0: cleanup 2014-01-10 14:09:11 -05:00
ssf.md version bump 0.5.0: cleanup 2014-01-10 14:09:11 -05:00

SSF

SpreadSheet Format (SSF) is a pure-JS library to format data using ECMA-376 spreadsheet format codes (like those used in Microsoft Excel)

This is written in voc -- see ssf.md for code.

To build: voc ssf.md

Setup

In the browser:

<script src="ssf.js"></script>

In node:

var SSF = require('ssf');

The script will manipulate module.exports if available (e.g. in a CommonJS require context). This is not always desirable. To prevent the behavior, define DO_NOT_EXPORT_SSF:

Usage

.load(fmt, idx) sets custom formats (generally indices above 164)

.format(fmt, val) formats val using the format fmt. If fmt is of type number, the internal table (and custom formats) will be used. If fmt is a literal format, then it will be parsed and evaluated.

.parse_date_code(val, opts) parses val as date code and returns object:

  • D,T: Date ([val]) Time ({val})
  • y,m,d: Year, Month, Day
  • H,M,S,u: (0-23)Hour, Minute, Second, Sub-second
  • q: Day of Week (0=Sunday, 1=Monday, ..., 5=Friday, 6=Saturday)

Notes

Format code 14 in the spec is broken; the correct format is 'mm/dd/yy' (dashes, not spaces)

License

Apache 2.0

Tests

Build Status

githalytics.com alpha