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

@thi.ng/strings

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/strings - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="0.2.0"></a>
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.1.1...@thi.ng/strings@0.2.0) (2018-08-08)
### Features
* **strings:** add opt prefix arg for radix() ([5864f2c](https://github.com/thi-ng/umbrella/commit/5864f2c))
<a name="0.1.1"></a>

@@ -8,0 +19,0 @@ ## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.1.0...@thi.ng/strings@0.1.1) (2018-08-08)

2

package.json
{
"name": "@thi.ng/strings",
"version": "0.1.1",
"version": "0.2.0",
"description": "Various string formatting & utility functions",

@@ -5,0 +5,0 @@ "main": "./index.js",

import { Stringer } from "./api";
/**
* Returns a `Stringer` which formats given numbers to `radix` and `len`.
* Returns a `Stringer` which formats given numbers to `radix`, `len`
* and with optional prefix (not included in `len`).
*
* @param radix
* @param len
* @param prefix
*/
export declare const radix: (radix: number, len: number) => Stringer<number>;
export declare const radix: (radix: number, len: number, prefix?: string) => Stringer<number>;
export declare const B8: Stringer<number>;

@@ -10,0 +12,0 @@ export declare const U8: Stringer<number>;

@@ -6,12 +6,14 @@ "use strict";

/**
* Returns a `Stringer` which formats given numbers to `radix` and `len`.
* Returns a `Stringer` which formats given numbers to `radix`, `len`
* and with optional prefix (not included in `len`).
*
* @param radix
* @param len
* @param prefix
*/
exports.radix = memoizej_1.memoizeJ((radix, n) => {
exports.radix = memoizej_1.memoizeJ((radix, n, prefix = "") => {
const buf = repeat_1.repeat("0", n);
return (x) => {
x = (x >>> 0).toString(radix);
return x.length < n ? buf.substr(x.length) + x : x;
return prefix + (x.length < n ? buf.substr(x.length) + x : x);
};

@@ -18,0 +20,0 @@ });

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