es-string-html-methods

1.0.3 • Public • Published

es-string-html-methods Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES-spec-compliant shim/polyfill/replacement for the Annex B String.prototype HTML methods that works as far down as ES3

This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the spec.

Because the String.prototype HTML methods depend on a receiver (the this value), the main export in each subdirectory takes the string to operate on as the first argument.

The main export of the package itself is simply an array of the available directory names. It’s sole intended use is for build tooling and testing.

Supported methods

Getting started

npm install --save es-string-html-methods

Usage/Examples

var blink = require('es-string-html-methods/blink');
var link = require('es-string-html-methods/link');
var assert = require('assert');

assert.equal(
	blink('a'),
	'<blink>a</blink>'
);
assert.equal(
	link('a', 'b'),
	'<a href="b">a</a>'
);
require('./auto'); // shim all of the methods

require('./anchor/auto'); // shim the “anchor” method

Tests

Simply clone the repo, npm install, and run npm test

Dependents (0)

Package Sidebar

Install

npm i es-string-html-methods

Weekly Downloads

449

Version

1.0.3

License

MIT

Unpacked Size

30.8 kB

Total Files

81

Last publish

Collaborators

  • ljharb