File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,24 @@ String.prototype.hasPrefix = function (prefix) {
56
56
const hasPrefix = this . indexOf ( prefix ) === 0 ;
57
57
return hasPrefix ;
58
58
} ;
59
+
60
+ /**
61
+ * @function hashCode
62
+ * @memberof String
63
+ * @description Return a hash code for a string.
64
+ * @returns number
65
+ */
66
+ String . prototype . hashCode = function ( ) {
67
+ let hash = 0 ;
68
+ let i ;
69
+ let chr ;
70
+ if ( this . length === 0 ) return hash ;
71
+ for ( i = 0 ; i < this . length ; i += 1 ) {
72
+ chr = this . charCodeAt ( i ) ;
73
+ // eslint-disable-next-line no-bitwise
74
+ hash = ( ( hash << 5 ) - hash ) + chr ;
75
+ // eslint-disable-next-line no-bitwise
76
+ hash |= 0 ; // Convert to 32bit integer
77
+ }
78
+ return Math . abs ( hash ) ;
79
+ } ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @djthorpe/js-framework" ,
3
- "version" : " 0.0.41 " ,
3
+ "version" : " 0.0.42 " ,
4
4
"description" : " Javascript Framework" ,
5
5
"main" : " dist/index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments