nl_tokens: Pads a slug to 2 significant digits . Examples : 1 - > 01 001 - > 01 12 - > 12 123 - > 123 0123 - > 123 Words are not padded : a - > a 0word - > 0word And as a matter of consistency : 0 - > 00 00 - > 00
pl_tokens: function normalizeSlug ( slug ) { if ( typeof slug !== 'string' ) throw new Error ( 'slug must be a string' ) ; if ( slug === '' ) throw <mask> Error ( 'slug cannot be an empty string' ) ; if ( isNaN ( Number ( slug ) ) ) return slug ; slug = slug . replace ( / ^(0+) / , '' ) . trim ( ) ; while ( slug . length < 2 ) { slug = '0' + slug ; } return slug ; }