Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

JSUS

nodeGame149MIT1.7.2

JavaScript UtilS. Extended functional programming support. JSUS helps!

functional, functional programming, util, general, array, eval, time, date, object, dom, parse, nodeGame

readme

JSUS: JavaScript UtilS.

Build Status

Collection of general purpose javascript functions. JSUS helps!

Libraries

  1. OBJ
  2. ARRAY
  3. TIME
  4. EVAL
  5. DOM
  6. RANDOM
  7. PARSE
  8. FS
  9. COMPATIBILITY
  10. QUEUE

Browser

In the browser, two objects are exported: JSUS and its shorthand J.

Build

Create your customized build of JSUS.js using the make file in the bin directory

node make.js build -a // Full build
node make.js build -l obj,array -o jsus-oa.js // Only object and array libs.

License

MIT

changelog

Change Log

1.7.2

  • Fixed #PARSE.isNumber receiving empty string returning NaN instead of false.

1.7.0 and 1.7.1

  • #ARRAY.rep works with non-array (it creates the array for you).

1.6.0

  • #DOM.makeTabbable to make divs and other HTML elements accessible via tab.
  • #DOM.makeClickable to make divs and other HTML elements clickable with by pressing SPACE or ENTER.
  • #ARRAY.seq applies the callback function also when start equals end.
  • #RANDOM.randomDate has a default start date: 01/01/1900.

1.5.0

  • #OBJ.add|removeClass accept a force parameter to be applied to normal objects.

1.4.0

  • #OBJ.randomKey picks a random key from object.
  • #RANDOM.randomDate creates a random date object within interval.

1.3.0

  • #OBJ.reverseObj accepts a callback to edit keys and values.

1.2.0

  • #OBJ.reverseObj switch all keys with values.

1.1.1

  • #PARSE.isNumber fixed bug when ueq and leq params were set.

1.1.0

  • #PARSE.isMobileAgent returns TRUE if a user agent is for a mobile device.

1.0.1

  • #FS is using path.sep.

1.0.0

  • J is exported as a top level object in the browser's window.
  • #JSUS.get alias of JSUS.require removed. #JSUS.get is now a method of the DOM library.
  • DOM library rewritten. Several methods removed and code optimized. Methods added: get, add|append, addAttributes. Methods modified: generateUniqueId, addCSS, addJS. Methods removed: getElement, addElement, addAttributes2Elem, getButton, addButton, getFieldset, addFieldset, getTextInput, addTextInput, getTextArea, addTextArea, getCanvas, addCanvas, getSlider, addSlider, getRadioButton, addRadioButton, getLabel, addLabel, getSelect, addSelect, getIFrame, addIFrame, addBreak, getDiv, addDiv.
  • #DOM.shuffleElements accepts a callback.
  • '#OBJ.keys` improved, read inline docs for new options.
  • #OBJ.objGetAllKeys removed.

0.18.0

  • #OBJ.mixin|mixout|mixcommon return the mixed object.
  • #PARSE.isEmail.
  • #RANDOM.randomEmail.
  • #Time.now.

0.17.0

  • ARRAY.indexOf
  • Several improvements in the ARRAY module.

0.16.1

  • ARRAY.isArray fallbacks on native code.

0.16.0

  • DOM.split() refactored. Supports custom level of recursion, and arrays keys can be inserted (omitted by default).

0.15.0

  • DOM.viewportSize().

0.14.0

  • Removed deprecated wrench methods. Users of FS lib should use 'fs-extra' for their purposes.

0.13.1

  • RANDOM.randomString() can use spaces.

0.13.0

  • RANDOM.randomString()

0.12.0

  • Removed prepublish script in package.json that might cause errors in some systems on install.

0.11.0

  • PARSE.stringifyAll() checks for type (fix bug with strings).
  • DOM.cookieSupport() checks for cookie support in browser.
  • DOM.blinkTitle()
  • DOM.playSound()
  • DOM.onFocusIn() and DOM.onFocusOut()` replace onFocusChange.

0.10.12

  • PARSE.parse() refactor.

0.10.11

  • TIME.getTimeM().

0.10.10

  • DOM.disableBackButton().

0.10.9

  • Fixed bug onFocusChange for recent Chrome.

0.10.8

  • Fixed bug introduced in previous version DOM.highlight().

0.10.7

  • FS.copyFile().

0.10.6

  • DOM.isNode() and DOM.isElement().

0.10.5

  • DOM.shuffleElements() improved type checking and error message.

0.10.4

  • DOM.getElementsByClassName() fixed bug for elements with multiple classes.

0.10.3

  • PARSE.range() accepts also numbers as expression.

0.10.2

  • PARSE.isInt(), PARSE.isFloat(), and PARSE.isNumber().

0.10.1

  • FS.resolveModuleDir() fix for JSUS dir.

0.10.0

  • #OBJ.clone() fixed bug with cloning arrays of objects.
  • #OBJ.classClone() clones an object preserving its class type.
  • #PARSE.funcName() retrieves the name of a function.
  • #PARSE.range() creates integer ranges based on specified criteria.
  • #DOM.getButton() does not add undefined id if none is passed.
  • #DOM.addEvent() and #DOM.removeEvent().
  • #DOM.isNode() checks if input is object first, avoiding throwing unncessary errors.
  • #DOM.write() transforms null in empty strings.
  • #DOM.getIFrameDocument returns null if no iframe document is found.
  • #OBJ.getKeyByValue returns key/s in a object associated to a specific value.
  • 'use strict' directives have been added where missing.

0.9.9

  • #DOM.shuffleElements() replaces #DOM.shuffleNodes(), still a copy of the former method. A bug on the number of elements in the order is fixed, and also the method is more reliable to detect the children elements also in old browsers.

0.9.8

  • #DOM.write() accepts undefined as text, and adds an empty string.

0.9.7

  • #DOM.sprintf() has default %strong and %em styles.
  • Polyfill for #Date.getISOString().

0.9.5

  • An empty console and console.log objects are added if undefined. This avoids throwing errors in old browsers.

0.9.4

  • #PARSE.getQueryString() accepts referer as second parameter.
  • #DOM.disableRightClick() and #DOM.enableRightClick().

0.9.3

  • #QUEUE.getRemoveCb() to get remove callbacks inside loops.
  • Better support for execution of callbacks after deletion and copy of files inside #FS.

0.9.2

  • #DOM.removeClass() improved.

0.9.1

  • `#QUEUE class added plust tests. It can manage a simple queue.

0.8.9

  • #DOM.addClass() extra space fix.
  • #DOM.addAttributes2Elem(): 'className' as an alternative to 'class'.

0.8.8

  • #DOM.shuffleNodes() correctly shuffles the nodes, and returns the id of the elements in the order used to append them.
  • PARSE.getQueryString() correctly returns the full query string when no argument is passed.

0.8.7

  • #DOM.shuffleNodes() bug fix.

0.8.6

  • #PARSE.getQueryString() completely rewritten.
  • #OBJ.mixout() and #OBJ.mixcommon() consider the null value
  • #EVAL.eval() more correctly uses typeof checking for window object

0.8.5

  • Cosmetic changes
  • #DOM.getBlankPage() removed from API
  • #DOM.removeChildrenFromNode() does not have a return value

0.8.4

  • #DOM.getElementsByClassName() added.

0.8.3

  • `#DOM.addIFrame() sets attributes correctly.

0.8.2

  • #DOM.style() behaves as expected in IE.

0.8.1

  • #DOM.addAttributes2Elem() correctly handles the style and class property also in IE.

0.8.0

  • #RANDOM implements a brand new series of pseudo random number generators: nextNormal(), nextLogNormal(), nextExponential(), nextBinomial(), and getNormalGenerator().
  • #DOM.sprintf() uses charAt for backward compatibility with IE, instead of treating the string as an array.

0.7.12

  • #DOM.isElement() works in Safari as well.

0.7.11

  • #DOM.addBorder() width typo fix.

0.7.10

  • #DOM.getIFrameAnyChild() added.

0.7.9

  • #DOM.getIFrameDocument() added.

0.7.8

  • Fixed bug in DOM.sprintf: string always correctly appended to root.

< 0.7.8

  • Lots of changes...