Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
@_000407/transpose.js
Advanced tools
Readme
transpose.js
- Chord Transposition made simpleThis is a simple utility for transposing the chords in a given composition. Once the CSS selector for the element that contains the chord, and the target transposition index is provided, the library can transpose the chord defined within the said element, to the given transposition index. Transposition index i
is in the range [-12 <= i <= +12]
.
import { Transpose } from '@_00407/transpose.js';
const t = new Transpose();
t.transpose(+1);
<script type="text/javascript" src="https://kanchana.senadheera.net/transpose.js/dist/transpose.min.js"></script> <!-- Transposer instance will be initialized in the window object -->
<button class="transpose transpose-down" onclick="Transposer.transpose(-1)">-1</button>
<button class="transpose transpose-reset" onclick="Transposer.transpose(0)">R</button>
<button class="transpose transpose-up" onclick="Transposer.transpose(+1)">+1</button>
N/A
npm install @_000407/transpose.js
<script type="text/javascript" src="https://kanchana.senadheera.net/transpose.js/dist/transpose.min.js"></script>
You may customize the behavior of transposed output rendering, selection of containers of chords etc as follows.
init
method of an instance - accepts an object contains configurationProperty | Description | Type | Req/Opt | Default |
---|---|---|---|---|
selector | CSS selector of the elements that contain the chords. | string | Optional | span.chord |
render | Function that renders the transposed chord output. | function | Optional | see Rendering |
By default, the rendering is done using the following function.
function(offset) {
for(let c of document.querySelectorAll(this.selector)) {
c.innerHTML = this.transposeChord(c.innerHTML, offset);
}
}
// During construction
const t = new Transposer({
selector: "span.chord",
render: function(offset) {
console.log("Overridden version");
for(let c of document.querySelectorAll(this.selector)) {
c.innerHTML = this.transposeChord(c.innerHTML, offset);
}
}
});
// Using init method
t.init({
selector: "span.chord",
render: function(offset) {
console.log("Overridden version");
for(let c of document.querySelectorAll(this.selector)) {
c.innerHTML = this.transposeChord(c.innerHTML, offset);
}
}
});
N/A
N/A
N/A
N/A
N/A
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
N/A
FAQs
This is a simple utility for transposing the chords in a given composition. Once the CSS selector for the element that contains the chord, and the target transposition index is provided, the library can transpose the chord defined within the said element,
We found that @_000407/transpose.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.