Forked with intention of open source contribution. 📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Go to file
SheetJS e32a2894c4 version bump 0.8.0: performance
- separate i4/r8 code (core functions optimized by v8)
- prefer faster methods when convenient
- node-based performance tests
2014-06-13 11:02:06 -04:00
bin
misc version bump 0.8.0: performance 2014-06-13 11:02:06 -04:00
test version bump 0.8.0: performance 2014-06-13 11:02:06 -04:00
.jscs.json version bump 0.7.1: performance 2014-06-04 20:14:59 -04:00
.npmignore version bump 0.8.0: performance 2014-06-13 11:02:06 -04:00
.travis.yml version bump 0.5.4: empty text is empty 2014-01-28 20:02:46 -05:00
index.html version bump 0.6.5: eliminating bad idioms 2014-04-25 11:22:36 -07:00
LICENSE
Makefile version bump 0.8.0: performance 2014-06-13 11:02:06 -04:00
package.json version bump 0.8.0: performance 2014-06-13 11:02:06 -04:00
README.md README fix CI badge [ci skip] 2014-04-25 11:27:27 -07:00
ssf.js version bump 0.8.0: performance 2014-06-13 11:02:06 -04:00
ssf.md version bump 0.8.0: performance 2014-06-13 11:02:06 -04: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, opts) 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)

.get_table() gets the internal format table (number to format mapping).

.load_table(table) sets the internal format table.

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

Coverage Status

githalytics.com alpha