An SMS message splitter with support for both GSM and Unicode.
npm install split-smssplit-sms
============
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Bower version][bower-image]][bower-url]
[![NPM][npmico-image]][npmico-url]
An SMS message splitter with support for both GSM and Unicode written in JavaScript.
GSM support is limited to GSM 03.38 with the extension table (see the [Wikipedia article][GSM-03.38]); no support for natural language shift tables exists at this time.
[View the demo...][demo-url]
npm install split-sms
var splitter = require('split-sms');
var info = splitter.split('JavaScript is fun!');
info will be:
json
{
"characterSet": "GSM",
"parts": [
{
"content": "JavaScript is fun!",
"length": 18,
"bytes": 18
}
],
"bytes": 18,
"length": 18,
"remainingInPart": 142
}
`
Unicode example:
`js
splitter.split('Snowman shows off! ☃');
`
`json
{
"characterSet": "Unicode",
"parts": [
{
"content": "Snowman shows off! ☃",
"length": 20,
"bytes": 40
}
],
"bytes": 40,
"length": 20,
"remainingInPart": 50
}
`
In The Browser
You can use Bower to install split-sms components:
`sh
$ bower install split-sms --save
`
You can also use [RawGit][rawgit-url] to link directly to specific versions of the built scripts.
For example, the following URLs are for [version 0.1.7][v0.1.7-url]:
| Type | URL |
| ---------- | ------------------------------------------------------------------------- |
| Source | https://github.com/Codesleuth/split-sms/blob/0.1.7/dist/split-sms.min.js |
| RawGit dev | https://rawgit.com/Codesleuth/split-sms/0.1.7/dist/split-sms.min.js |
| RawGit CDN | https://cdn.rawgit.com/Codesleuth/split-sms/0.1.7/dist/split-sms.min.js |
Alternatively, pull out the scripts in the dist/ directory and consume them.
To generate a browser consumable script yourself, clone the repo and run the following commands:
`sh
$ npm install
$ npm run build
`
This will generate the browser-compatible scripts in dist/ and export splitter to the global so you can then consume it in the browser as follows:
`html
``