Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

words.js

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

words.js - npm Package Compare versions

Comparing version 0.2.9 to 0.3.0

4

package.json
{
"name": "words.js",
"version": "0.2.9",
"version": "0.3.0",
"description": "A flexible, robust and powerful Javascript word-string manipulation library.",

@@ -30,5 +30,5 @@ "main": "words.min.js",

"dependencies": {
"strings.js" : "1.1.9"
"strings.js" : "1.2.1"
},
"devDependencies": {}
}

@@ -19,8 +19,8 @@ words.js

words.set('you can reverse all word positions').upper(3).reverse();
words.set('you can reverse all word positions').upper(-1, 3).reverse();
console.log( words.$ );
// positions word all REVERSE can you
// POSITIONS word all REVERSE can you
words.set('or reverse or remove specific words and sort?')
.reverse(2, -1).remove('or', 'remove').sort();
.reverse(2, -1).remove('or', 'remove').replace.sort();
console.log( words.$ );

@@ -38,3 +38,3 @@ // ?tros and esrever specific words

words.set('Words.startsWith searches for matching words');
words.set('Words.startsWith searches for starting words, not characters!');
console.log( words.startsWith('Words.') );

@@ -91,2 +91,8 @@ // false

**Words.prototype.words**
> `<array> words`
> The internal array were all (space seperated) words are stored. Better not use directly to avoid bugs, instead
> use .set() to set, and .get(), .$ and .string to fetch.
**Words.prototype.constructor**

@@ -106,5 +112,5 @@ > `<this> constructor( <string>/<number> string= '' )`

**Words.prototype.count**
> `count`
> `<number> count`
> A getter to get the amount of words in the internal array.
> A getter to get the amount of words in this.words.

@@ -120,3 +126,3 @@ ```javascript

> Set the internal array. Use any combination of arguments to form a string. All
> Set this.words. Use any combination of arguments to form a string. All
> invalid arguments will be ignored.

@@ -142,3 +148,3 @@

**Words.prototype.$**
> `$`
> `<string> $`

@@ -154,3 +160,3 @@ > A getter for .get()

**Words.prototype.string**
> `string`
> `<string> string`

@@ -162,8 +168,8 @@ > Another getter for .get(), similar to .$.

> Access every index/word of the internal array and apply the result of callback to it. After a call to xs, the
> internal array will be changed to the results of the callback.
> Access every index/word of this.words and apply the result of callback to it. After a call to xs, this.words
> will be changed to the results of the callback.
> If the callback returns true, word is applied, but you could also return word which has effectively the same result.
> If the callback returns false or undefined, word will be skipped. Any character, String or Number returned by callback
> will be applied to index in the internal array.
> will be applied to index in this.words.

@@ -193,3 +199,3 @@ ```javascript

> Returns an array containing all indices(numbers) in the internal array where substring is found.
> Returns an array containing all indices(numbers) in this.words where substring is found.

@@ -232,4 +238,4 @@ ```javascript

> Without arguments the internal array is reversed; not the characters, like with Strings.reverse(), but the words
> positions in the internal array are reversed. If index is 0, every word is reversed, but will remain on it's original/current index,
> Without arguments this.words is reversed; not the characters, like with Strings.reverse(), but the words
> positions in this.words are reversed. If index is 0, every word is reversed, but will remain on it's original/current index,
> every additional argument is then ignored. With index or indices given, the characters in the words

@@ -278,3 +284,3 @@ > denoted by indices are reversed.

> Resets the internal array to empty [].
> Resets this.words to empty [].

@@ -284,3 +290,3 @@ **Words.prototype.remove**

> Removes any combination of indices or words from the internal array. Without arguments remove does nothing.
> Removes any combination of indices or words from this.words. Without arguments remove does nothing.
> Invalid arguments are ignored

@@ -295,6 +301,6 @@

**Words.prototype.pop**
> `pop( <string>/<number> amount )`
> `<this> pop( <string>/<number> amount )`
> Removes the last word from the internal array if no arguments are given. If amount is valid, amount words will
> be removed from the internal array, starting from the last word going backwards.
> Removes the last word from this.words if no arguments are given. If amount is valid, amount words will
> be removed from this.words, starting from the last word going backwards.

@@ -308,5 +314,5 @@ ```javascript

**Words.prototype.push**
> `push( <string>/<number> word, [word1, ..., wordN] )`
> `<this> push( <string>/<number> word, [word1, ..., wordN] )`
> Adds words to the end of the internal array.
> Adds words to the end of this.words.

@@ -320,7 +326,7 @@ ```javascript

**Words.prototype.shift**
> `shift( <string>/<number> amount )`
> `<this> shift( <string>/<number> amount )`
> Removes the first word from the internal array if no arguments are given. If amount is valid, amount words will
> be removed from the internal array, starting from the first word going forwards.
> Removes the first word from this.words if no arguments are given. If amount is valid, amount words will
> be removed from this.words, starting from the first word going forwards.

@@ -334,5 +340,5 @@ ```javascript

**Words.prototype.unshift**
> `unshift( <string>/<number> word, [word1, ..., wordN] )`
> `<this> unshift( <string>/<number> word, [word1, ..., wordN] )`
> Adds words to the beginning of the internal array.
> Adds words to the beginning of this.words.

@@ -346,5 +352,5 @@ ```javascript

**Words.prototype.insert**
> `insert( <string>/<number> index, <string>/<number> word, [word1, ..., wordN] )`
> `<this> insert( <string>/<number> index, <string>/<number> word, [word1, ..., wordN] )`
> Insert word(s) at index of the internal array.
> Insert word(s) at index of this.words.

@@ -358,3 +364,3 @@ ```javascript

**Words.prototype.replace**
> `replace( <string>/<number> selection, <string>/<number> replacement )`
> `<this> replace( <string>/<number> selection, <string>/<number> replacement )`

@@ -373,3 +379,3 @@ > Replace all words equal to selection to replacement.

> Sorts the internal array alphabetically
> Sorts this.words alphabetically

@@ -385,3 +391,3 @@ ```javascript

> Returns true only if the internal string/array starts with string
> Returns true only if this.words starts with string

@@ -397,3 +403,3 @@ ```javascript

> Returns true only if the internal string/array ends with string
> Returns true only if this.words ends with string

@@ -411,2 +417,9 @@ ```javascript

**0.3.0**
Updated
- strings.js dependency to the latest version 1.2.1.
- readme
_______________________________
**0.2.9**

@@ -452,3 +465,3 @@

Words.prototype.find only finds words now, use Strings.find for finding characters in words.
Words.prototype.remove(0) has been removed as an option to clear the internal array. Not a big thing, I just thought
Words.prototype.remove(0) has been removed as an option to clear this.words. Not a big thing, I just thought
that we have .clear() for that, so it felt a bit confusing and redundant.

@@ -455,0 +468,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc