2.1.0 • Published 7 years ago
@tubepress/es-utils v2.1.0
TubePress ECMAScript Utilities
A collection of application-agnostic ES6 modules with the following goals:
- Modules should provide stable interfaces to accomplish common tasks
- Module implementations should be lightweight, high-quality, and may be 3rd-party
- Modules must support ES5 environments
List of modules
- DOM
add-ready-handler: adds a DOM-ready callbackload-script: append a<script>to the DOM<head>
- function
debounce: throttle the invocation of a function
- is
is-array: determine if an item is an arrayis-defined: determine if an item is definedis-string: determine if an item is a stringis-undefined: determine if an item is undefined
- object
assign: universalObject.assign()has-own-property:Object.hasOwnProperty()that also accepts nested keys
- string
ends-with: determine if a string ends with another string
Example Usage
import endsWith from '@tubepress/es-utils/es/string/ends-with';
if (endsWith('foo-bar', 'bar')) {
...
}