npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pd-sputil

v2.3.4

Published

<a name="module_pdsputil"></a>

Downloads

19

Readme

pdsputil

Common utilities for working with SharePoint

pdsputil.spSaveForm([formId], saveButtonValue) ⇒ void

Saves SP out of the box form Editform, Newform

Kind: static method of pdsputil

| Param | Type | | --- | --- | | [formId] | string | | saveButtonValue | string |

pdsputil.domReady(callback, context) ⇒ void

Invokes the callback when dom is ready context is passed to the call back as first parameter

Kind: static method of pdsputil

| Param | Type | | --- | --- | | callback | requestCallback | | context | object |

pdsputil.getDataType(item) ⇒ string

Return the javascript type in lowercase, ex array object

Kind: static method of pdsputil

| Param | Type | | --- | --- | | item | * |

pdsputil.elementTagName(element) ⇒ string

Returns a lower case element tag name ex div

Kind: static method of pdsputil

| Param | Type | | --- | --- | | element | JQuery | HTMLElement |

pdsputil.argsConverter(args, startAt) ⇒ Array

Takes a functions arguments and converts it to an array

Kind: static method of pdsputil

| Param | Type | | --- | --- | | args | Array | | startAt | number |

pdsputil.arrayInsertAtIndex(array, index) ⇒ Array

Inserts an item or items starting at the passed index

Kind: static method of pdsputil

| Param | Type | | --- | --- | | array | Array | | index | number |

pdsputil.arrayRemoveAtIndex(array, index) ⇒ Array

Removes an item from index of the passed array

Kind: static method of pdsputil

| Param | Type | | --- | --- | | array | Array | | index | number |

pdsputil.encodeAccountName(acctName) ⇒ string

Adds the beginning string to an email and encodes it for url use

Kind: static method of pdsputil

| Param | Type | | --- | --- | | acctName | string |

pdsputil.promiseDelay(time) ⇒ promise

Returns a promise that will resolve in the given time or default to 5 secs

Kind: static method of pdsputil

| Param | Type | | --- | --- | | time | number |

pdsputil.exportToCSV(filename, rows) ⇒ void

Creates a CSV file from the passed array

Kind: static method of pdsputil

| Param | Type | | --- | --- | | filename | string | | rows | Array.<Array.<string>> |

pdsputil.getPageInfo() ⇒ object

Returns the SP pageObj that is on all SP pages

Kind: static method of pdsputil

pdsputil.spGotoUrl(url) ⇒ void

Navigates the user to the url passed

Kind: static method of pdsputil

| Param | Type | | --- | --- | | url | string |

pdsputil.spSearchResultsCleaner(results, neededProps) ⇒ Array.<object>

Cleans the ajax search results to an array of objects

Kind: static method of pdsputil

| Param | Type | | --- | --- | | results | Array.<object> | | neededProps | Array.<string> |

pdsputil.pageEditModeTest() ⇒ boolean

Lets the script know if the SP page is in edit mode

Kind: static method of pdsputil

pdsputil.hideRibbon() ⇒ void

Hides the ribbon at the top of an SP page

Kind: static method of pdsputil

pdsputil.URLparameters() ⇒ object

Returns an object of the search properties in a url

Kind: static method of pdsputil

pdsputil.waitForScriptsReady(scriptName) ⇒ Promise

Returns a promise that is resolved when the passed SP (only) script file is loaded

Kind: static method of pdsputil

| Param | Type | | --- | --- | | scriptName | string |

pdsputil.tableRowLoop(table, cb) ⇒ void

Loops through all rows of the passed table

Kind: static method of pdsputil

| Param | Type | | --- | --- | | table | JQuery | | cb | function |

pdsputil.loadSPScript(fileName) ⇒ Promise

Returns a promise that resolves when the script file is loaded, any script file

Kind: static method of pdsputil

| Param | Type | | --- | --- | | fileName | string |

pdsputil.validGuid(guid) ⇒ boolean

Test a string to ensure it is a valid guid

Kind: static method of pdsputil

| Param | Type | | --- | --- | | guid | string |

pdsputil.getURLOrigin() ⇒ string

Returns the origin of the current site

Kind: static method of pdsputil

pdsputil.createGUID() ⇒ string

Creates a SharePoint GUID in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Kind: static method of pdsputil

pdsputil~sesStorage

Kind: inner class of pdsputil

new sesStorage()

Class creates a new instance of sesStorage

sesStorage.getItem(key) ⇒ *

Retrieves an item from session storage

Kind: instance method of sesStorage

| Param | Type | | --- | --- | | key | string |

sesStorage.setItem(key, value) ⇒ void

Stores an item from session storage

Kind: instance method of sesStorage

| Param | Type | | --- | --- | | key | string | | value | * |

sesStorage.removeItem(key) ⇒ void

Removes an item from session storage

Kind: instance method of sesStorage

| Param | Type | | --- | --- | | key | string |

pdsputil~Sublish

Kind: inner class of pdsputil

new Sublish()

Class creates a new pub sub object

sublish.publish(id, ...args) ⇒ void

Publishes data to subscribers

Kind: instance method of Sublish

| Param | Type | Description | | --- | --- | --- | | id | string | | | ...args | args | all items passed in will be added as parameters of function with same id |

sublish.subscribe(id, fn) ⇒ void

Subscribes a function to an id for the fn the function will recieve whatever arguments are passed to publish so your parameters to the function should be whatever you are going to pass publish to the given id

Kind: instance method of Sublish

| Param | Type | | --- | --- | | id | string | | fn | subscription |

sublish.unsubscribe(id, fn) ⇒ void

Unsubscribes a function for the fn the function passed must be an exact reference to the function or it will not match

Kind: instance method of Sublish

| Param | Type | | --- | --- | | id | string | | fn | unsub |

sublish.clear(id) ⇒ void

Clears the internal cache so all subscribed function all be removed

Kind: instance method of Sublish

| Param | Type | | --- | --- | | id | string |

pdsputil~requestCallback ⇒ void

Function that is called when the dom is ready

Kind: inner typedef of pdsputil

| Param | Type | | --- | --- | | context | * |

pdsputil~subscription ⇒ void

function typedef for callback to subscribe to an emitted event.

Kind: inner typedef of pdsputil
Returns: void - responseMessage

| Type | Description | | --- | --- | | args | whatever you pass into publish will be passed in here |

pdsputil~unsub ⇒ void

This function is a identifier for matching so it can be removed.

Kind: inner typedef of pdsputil
Returns: void - - responseMessage

| Type | Description | | --- | --- | | args | whatever you pass into publish will be passed in here |