0.5.1 • Published 4 years ago
@screamingfrog/newtils v0.5.1
@screamingfrog/newtils
A collection of utility methods and classes to aid in project creation.
Classes
AnimationController- Start, stop and apply animations to elements.BrowserChecker- Check the current browser being used, and apply browser-specific class names to the<body />.El- Create and interact with HTML Elements.ElementCache- Cache results ofquerySelectorandquerySelectorAll.MergeSorter- Comprehensive array sorter.Table- Comprehensive<table />builder.ZoomPanner- Add zoom/panning functionality to an<img />in a containing element.
Utilities
Array
findObjects- Filter an array of objects by a specific key/value pairing.partition- Split an array into two by a predicate function.sortObjects- Sort an array of objects, with optional ranking/ignoring functionality.sortPrimitives- Sort an array of primitives with optional ignoring functionality.splitAt- Split an array into two at a specified position.toArray- Wrap values in arrays, if not already an array.toUniques- Remove duplicate items from an array.
Boolean
toBoolean- Convert values to their boolean equivalent (incl. "yes", "true" etc.).
DOM
appendChildren- Append child nodes to a parent element.createElement- Streamline the HTML Element creation process.delegateEvents- Group event listeners/handlers logic in one place.generateSocialLinks- Generatehrefvalues for specified<a />elements based on metadata.makeBackToToppable- Give an element 'back to top' functionality, as well as classes dependent on scroll position.moveElAtBreakpoint- Append an element to other elements at respective breakpoints.removeChildren- Remove child nodes from a parent element.setAttributeOnNodes- Set an attribute on nodes matching the provided selector.smoothScroll- Cross-browser smooth scroll functionality.
Is
isBoolean- Determine if a value is a boolean value.isDefined- Determine if a value is defined.isFunction- Determine if a value is a function.isNumber- Determine if a value is a number.isObject- Determine if a value is an object.isString- Determine if a value is a string.isTouchDevice- Determine if the user is on a touch device.isUnsupportedBrowser- Determine if the user is on an unsupported browser.
Maths
getRandomNumber- Generate a random number (optionally: between bounds).getUniqueNumber- Generate a unique number.isEven- Determine if a number is even.isOdd- Determine if a number is odd.modulo- Custom JavaScript remainder (%) function.
Misc
debounce- Debounces a function read more.easings- A collection of easing functions.noop- Does nothing :Dthrottle- Throttles a function read more.
Object
deepMerge- Deeply merges two or more objects.sortKeys- Sorts an object's keys by ASCII value.
String
capitalise- Capitalises one word, or all the words, of a stringtoKebabCase- Converts from PascalCase to kebab-case.toNumber- Extracts a number from a string by removing commonly used symbols (e.g."£1,000"->1000)toOrdinal- Adds appropriate ordinal suffix to a number (e.g.1->"1st")
Deprecated Classes
compat- Comptability functions for old JavaScript utilities.DepElement- Deprecated version ofEl.DepEventDelegator- Deprecated version ofdom/delegateEvents.DepTable- Deprecated version ofTable.MergeSort- No updated equivalent.State- No updated equivalent.
0.5.1-testing.0
4 years ago
0.5.0-testing.2
4 years ago
0.5.0-testing.3
4 years ago
0.5.0-testing.4
4 years ago
0.5.0
4 years ago
0.5.1
4 years ago
0.5.0-testing.1
4 years ago
0.5.0-testing
4 years ago
0.4.1
4 years ago
0.4.0
4 years ago
0.3.0
4 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago
0.0.0
4 years ago